home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / xml4j.jar / com / ibm / xml / internal / DefaultScanner.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-08-30  |  39.0 KB  |  4,112 lines

  1. package com.ibm.xml.internal;
  2.  
  3. import com.ibm.xml.framework.AttDef;
  4. import com.ibm.xml.framework.Attr;
  5. import com.ibm.xml.framework.AttrPool;
  6. import com.ibm.xml.framework.ChunkyCharArray;
  7. import com.ibm.xml.framework.ContentSpecNode;
  8. import com.ibm.xml.framework.ElementDecl;
  9. import com.ibm.xml.framework.ElementDeclPool;
  10. import com.ibm.xml.framework.EntityDecl;
  11. import com.ibm.xml.framework.EntityPool;
  12. import com.ibm.xml.framework.NotationDecl;
  13. import com.ibm.xml.framework.ParserState;
  14. import com.ibm.xml.framework.ScanContentState;
  15. import com.ibm.xml.framework.StringPool;
  16. import com.ibm.xml.framework.XMLDocumentHandler;
  17. import com.ibm.xml.framework.XMLDocumentTypeHandler;
  18. import com.ibm.xml.framework.XMLEntityHandler;
  19. import com.ibm.xml.framework.XMLErrorHandler;
  20. import com.ibm.xml.framework.XMLReader;
  21. import com.ibm.xml.framework.XMLScanner;
  22. import com.ibm.xml.framework.XMLValidationHandler;
  23. import java.io.UnsupportedEncodingException;
  24. import org.xml.sax.InputSource;
  25. import org.xml.sax.Locator;
  26.  
  27. public class DefaultScanner implements XMLScanner, Locator {
  28.    private static final boolean DEBUG_STOP = false;
  29.    private static final boolean DEBUG_NMTOKEN_ENTITY = false;
  30.    private static final int ST_NORMAL = 1;
  31.    private static final int ST_INTERNAL_SUBSET = 2;
  32.    private static final int ST_EXTERNAL_SUBSET = 3;
  33.    private static final byte GENERAL_ENTITY_TYPE = 0;
  34.    private static final byte PARAMETER_ENTITY_TYPE = 1;
  35.    private static final char[] cdata_string = new char[]{'C', 'D', 'A', 'T', 'A'};
  36.    private static final char[] xml_string = new char[]{'x', 'm', 'l'};
  37.    private static final char[] version_string = new char[]{'v', 'e', 'r', 's', 'i', 'o', 'n'};
  38.    private static final char[] doctype_string = new char[]{'D', 'O', 'C', 'T', 'Y', 'P', 'E'};
  39.    private static final char[] standalone_string = new char[]{'s', 't', 'a', 'n', 'd', 'a', 'l', 'o', 'n', 'e'};
  40.    private static final char[] yes_string = new char[]{'y', 'e', 's'};
  41.    private static final char[] no_string = new char[]{'n', 'o'};
  42.    private static final char[] element_string = new char[]{'E', 'L', 'E', 'M', 'E', 'N', 'T'};
  43.    private static final char[] empty_string = new char[]{'E', 'M', 'P', 'T', 'Y'};
  44.    private static final char[] any_string = new char[]{'A', 'N', 'Y'};
  45.    private static final char[] pcdata_string = new char[]{'#', 'P', 'C', 'D', 'A', 'T', 'A'};
  46.    private static final char[] attlist_string = new char[]{'A', 'T', 'T', 'L', 'I', 'S', 'T'};
  47.    private static final char[] id_string = new char[]{'I', 'D'};
  48.    private static final char[] ref_string = new char[]{'R', 'E', 'F'};
  49.    private static final char[] entit_string = new char[]{'E', 'N', 'T', 'I', 'T'};
  50.    private static final char[] ies_string = new char[]{'I', 'E', 'S'};
  51.    private static final char[] nmtoken_string = new char[]{'N', 'M', 'T', 'O', 'K', 'E', 'N'};
  52.    private static final char[] notation_string = new char[]{'N', 'O', 'T', 'A', 'T', 'I', 'O', 'N'};
  53.    private static final char[] required_string = new char[]{'#', 'R', 'E', 'Q', 'U', 'I', 'R', 'E', 'D'};
  54.    private static final char[] implied_string = new char[]{'#', 'I', 'M', 'P', 'L', 'I', 'E', 'D'};
  55.    private static final char[] fixed_string = new char[]{'#', 'F', 'I', 'X', 'E', 'D'};
  56.    private static final char[] include_string = new char[]{'I', 'N', 'C', 'L', 'U', 'D', 'E'};
  57.    private static final char[] ignore_string = new char[]{'I', 'G', 'N', 'O', 'R', 'E'};
  58.    private static final char[] entity_string = new char[]{'E', 'N', 'T', 'I', 'T', 'Y'};
  59.    private static final char[] system_string = new char[]{'S', 'Y', 'S', 'T', 'E', 'M'};
  60.    private static final char[] public_string = new char[]{'P', 'U', 'B', 'L', 'I', 'C'};
  61.    private static final char[] ndata_string = new char[]{'N', 'D', 'A', 'T', 'A'};
  62.    private static final char[] encoding_string = new char[]{'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g'};
  63.    private static final boolean PRINT_EXCEPTION_STACK_TRACE = false;
  64.    protected ParserState fParserState;
  65.    private int fScannerState = 1;
  66.    private int fScannerMarkupDepth;
  67.    private int fScannerParenDepth;
  68.    private XMLReader fReader;
  69.    private boolean fStandalone = false;
  70.    private boolean fCalledStartDocument = false;
  71.    protected XMLDocumentHandler fDocumentHandler;
  72.    protected XMLDocumentTypeHandler fDocumentTypeHandler;
  73.    protected XMLValidationHandler fValidationHandler;
  74.    protected XMLEntityHandler fEntityHandler;
  75.    protected XMLErrorHandler fErrorHandler;
  76.    protected StringPool fStringPool;
  77.    protected AttrPool fAttrPool;
  78.    protected EntityPool fEntityPool;
  79.    protected ElementDeclPool fElementDeclPool;
  80.    private ChunkyCharArray fLiteralData;
  81.    private EntityPool fParameterEntityPool;
  82.    private int fXMLSymbolIndex = -1;
  83.    private Attr fAttr = new Attr();
  84.    private int fAttValueIndex = -1;
  85.    private char[] fCharRefData;
  86.    private int fSystemLiteral = -1;
  87.    private int fPubidLiteral = -1;
  88.    private ElementDecl fElementDecl;
  89.    private ContentSpecNode fContentSpecNode;
  90.    private AttDef fAttDef;
  91.    private NotationDecl fNotationDecl;
  92.    private EntityDecl fEntityDecl;
  93.    private XMLReader[] fReaderStack = new XMLReader[8];
  94.    private InputSource[] fReaderSource = new InputSource[8];
  95.    private int[] fReaderMarkupDepth = new int[8];
  96.    private int[] fReaderParenDepth = new int[8];
  97.    private int fReaderStackDepth;
  98.    private int fActiveReaderLimit;
  99.    private int[] fElementNameStack = new int[8];
  100.    private int[] fElementChildCount = new int[8];
  101.    private int[][] fElementChildren = new int[8][];
  102.    private int fElementDepth = -1;
  103.    private byte[] fEntityTypeStack;
  104.    private int[] fEntityNameStack;
  105.    private int fEntityStackDepth;
  106.    private byte[] opStack;
  107.    private int[] nodeIndexStack;
  108.    private int[] prevNodeIndexStack;
  109.    private boolean fStop = false;
  110.    private static final boolean DEBUG_PAREN_DEPTH = false;
  111.    private static final boolean DEBUG_MARKUP_DEPTH = false;
  112.  
  113.    public DefaultScanner(ParserState var1) {
  114.       this.fParserState = var1;
  115.    }
  116.  
  117.    public void reset(ParserState var1) {
  118.       this.fParserState = var1;
  119.       this.fStop = false;
  120.       this.fCalledStartDocument = false;
  121.    }
  122.  
  123.    public void refreshParserState(ParserState var1) {
  124.       this.fDocumentHandler = this.fParserState.getDocumentHandler();
  125.       this.fDocumentTypeHandler = this.fParserState.getDocumentTypeHandler();
  126.       this.fEntityHandler = this.fParserState.getEntityHandler();
  127.       this.fErrorHandler = this.fParserState.getErrorHandler();
  128.       this.fValidationHandler = this.fParserState.getValidationHandler();
  129.       this.fStringPool = this.fParserState.getStringPool();
  130.       this.fAttrPool = this.fParserState.getAttrPool();
  131.       this.fEntityPool = this.fParserState.getEntityPool();
  132.       this.fElementDeclPool = this.fParserState.getElementDeclPool();
  133.    }
  134.  
  135.    public Locator getLocator() {
  136.       return this;
  137.    }
  138.  
  139.    public String getPublicId() {
  140.       return this.fReader == null ? null : this.fReader.getSystemId();
  141.    }
  142.  
  143.    public String getSystemId() {
  144.       return this.fReader == null ? null : this.fReader.getSystemId();
  145.    }
  146.  
  147.    public int getLineNumber() {
  148.       return this.fReader == null ? -1 : this.fReader.getLineNumber();
  149.    }
  150.  
  151.    public int getColumnNumber() {
  152.       return this.fReader == null ? -1 : this.fReader.getColumnNumber();
  153.    }
  154.  
  155.    private void emitError(int var1) throws Exception {
  156.       this.fErrorHandler.error(var1);
  157.    }
  158.  
  159.    private void emitError(int var1, int var2) throws Exception {
  160.       this.fErrorHandler.error1(var1, var2);
  161.    }
  162.  
  163.    private void emitError(int var1, int var2, int var3) throws Exception {
  164.       this.fErrorHandler.error2(var1, var2, var3);
  165.    }
  166.  
  167.    public void stop() {
  168.       this.fStop = true;
  169.    }
  170.  
  171.    public void scanDocument(InputSource var1) throws Exception {
  172.       this.refreshParserState(this.fParserState);
  173.       this.fScannerState = 1;
  174.       this.fLiteralData = new ChunkyCharArray(this.fStringPool);
  175.       this.fParameterEntityPool = null;
  176.       this.fXMLSymbolIndex = -1;
  177.  
  178.       try {
  179.          this.fReader = this.fEntityHandler.createReader(var1, true);
  180.       } catch (UnsupportedEncodingException var4) {
  181.          int var3 = this.fStringPool.addString(((Throwable)var4).getMessage());
  182.          this.fErrorHandler.error1(52, var3);
  183.          return;
  184.       } catch (Exception var5) {
  185.          throw var5;
  186.       }
  187.  
  188.       this.fEntityHandler.startInputSource(var1);
  189.  
  190.       try {
  191.          this.scanProlog();
  192.          if (this.fDocumentHandler != null && !this.fCalledStartDocument) {
  193.             this.fDocumentHandler.startDocument(-1, -1, -1);
  194.             this.fCalledStartDocument = true;
  195.          }
  196.  
  197.          this.fEntityPool.checkUnparsedEntities();
  198.          int var2 = this.fReader.scanName('>', -1);
  199.          if (var2 == -1) {
  200.             this.fErrorHandler.error(122);
  201.          } else {
  202.             if (this.fValidationHandler != null) {
  203.                this.fValidationHandler.checkRootElementName(var2);
  204.             }
  205.  
  206.             if (this.scanElement(var2)) {
  207.                if (this.fElementDepth >= 0) {
  208.                   ScanContentState var10 = new ScanContentState();
  209.                   var10.inCDSect = false;
  210.                   var10.extParsedEnt = false;
  211.                   var10.parseTextDecl = false;
  212.                   var10.elementDepth = 0;
  213.                   this.scanContent(var10);
  214.                   if (this.fValidationHandler != null) {
  215.                      this.fValidationHandler.checkIDRefNames();
  216.                   }
  217.                }
  218.  
  219.                this.scanMisc();
  220.             }
  221.          }
  222.       } catch (ArrayIndexOutOfBoundsException var6) {
  223.          if (this.fElementDepth >= 0) {
  224.             int var9 = this.fElementNameStack[this.fElementDepth];
  225.             this.fErrorHandler.error1(124, var9);
  226.          }
  227.  
  228.          if (this.fScannerMarkupDepth > 0) {
  229.             this.fErrorHandler.error(116);
  230.          }
  231.       } catch (StopException var7) {
  232.       } catch (Exception var8) {
  233.          throw var8;
  234.       }
  235.  
  236.       if (!this.fStop) {
  237.          if (this.fDocumentHandler != null && this.fCalledStartDocument) {
  238.             this.fDocumentHandler.endDocument();
  239.          }
  240.  
  241.          this.fEntityHandler.endInputSource(var1);
  242.       } else {
  243.          while(this.fReaderStackDepth > 0) {
  244.             this.fReaderStack[--this.fReaderStackDepth] = null;
  245.             this.fReaderSource[this.fReaderStackDepth] = null;
  246.          }
  247.  
  248.       }
  249.    }
  250.  
  251.    public void scanDTD(InputSource var1) throws Exception {
  252.       this.fDocumentHandler = this.fParserState.getDocumentHandler();
  253.       this.fDocumentTypeHandler = this.fParserState.getDocumentTypeHandler();
  254.       this.fEntityHandler = this.fParserState.getEntityHandler();
  255.       this.fErrorHandler = this.fParserState.getErrorHandler();
  256.       this.fValidationHandler = this.fParserState.getValidationHandler();
  257.       this.fStringPool = this.fParserState.getStringPool();
  258.       this.fAttrPool = this.fParserState.getAttrPool();
  259.       this.fEntityPool = this.fParserState.getEntityPool();
  260.       this.fElementDeclPool = this.fParserState.getElementDeclPool();
  261.       this.fLiteralData = new ChunkyCharArray(this.fStringPool);
  262.       this.fParameterEntityPool = null;
  263.       this.fXMLSymbolIndex = -1;
  264.       this.fScannerState = 3;
  265.       this.fReader = this.fEntityHandler.createReader(var1, false);
  266.       this.fEntityHandler.startInputSource(var1);
  267.       if (this.fDocumentHandler != null && !this.fCalledStartDocument) {
  268.          this.fDocumentHandler.startDocument(-1, -1, -1);
  269.          this.fCalledStartDocument = true;
  270.       }
  271.  
  272.       int var2 = this.fStringPool.addSymbol("");
  273.       this.fElementDeclPool.setRootElement(var2);
  274.       if (this.fDocumentTypeHandler != null) {
  275.          this.fDocumentTypeHandler.doctypeDecl(var2);
  276.       }
  277.  
  278.       if (this.fDocumentTypeHandler != null) {
  279.          this.fDocumentTypeHandler.startExternalSubset(-1, -1);
  280.       }
  281.  
  282.       try {
  283.          this.scanExtSubsetDecl(false);
  284.       } catch (ArrayIndexOutOfBoundsException var4) {
  285.          if (this.fScannerMarkupDepth > 0) {
  286.             this.fErrorHandler.error(116);
  287.          }
  288.       } catch (StopException var5) {
  289.       } catch (Exception var6) {
  290.          throw var6;
  291.       }
  292.  
  293.       if (this.fDocumentTypeHandler != null) {
  294.          this.fDocumentTypeHandler.endExternalSubset();
  295.       }
  296.  
  297.       if (this.fParserState.getValidationHandler() != null) {
  298.          this.fElementDeclPool.checkDeclaredElements();
  299.       }
  300.  
  301.       this.fEntityPool.checkUnparsedEntities();
  302.       if (!this.fStop) {
  303.          if (this.fDocumentHandler != null && this.fCalledStartDocument) {
  304.             this.fDocumentHandler.endDocument();
  305.          }
  306.  
  307.          this.fEntityHandler.endInputSource(var1);
  308.       } else {
  309.          while(this.fReaderStackDepth > 0) {
  310.             this.fReaderStack[--this.fReaderStackDepth] = null;
  311.             this.fReaderSource[this.fReaderStackDepth] = null;
  312.          }
  313.  
  314.       }
  315.    }
  316.  
  317.    private boolean scanEq() throws Exception {
  318.       this.fReader.skipPastSpaces();
  319.       if (this.fReader.skippedChar('=')) {
  320.          this.fReader.skipPastSpaces();
  321.          return true;
  322.       } else {
  323.          return false;
  324.       }
  325.    }
  326.  
  327.    private boolean scanComment(boolean var1) throws Exception {
  328.       int var2 = this.fReader.currentOffset();
  329.       boolean var3 = false;
  330.  
  331.       while(true) {
  332.          boolean var4 = false;
  333.  
  334.          try {
  335.             var4 = this.fReader.lookingAtChar('-');
  336.          } catch (ArrayIndexOutOfBoundsException var10) {
  337.             if ((this.fEntityStackDepth == 0 ? 0 : this.fEntityNameStack[this.fEntityStackDepth - 1]) == 0) {
  338.                this.fErrorHandler.error(21);
  339.             }
  340.  
  341.             throw var10;
  342.          }
  343.  
  344.          if (var4) {
  345.             int var5 = this.fReader.currentOffset();
  346.             int var6 = 0;
  347.             int var7 = this.fReader.skipAsciiChar();
  348.  
  349.             int var8;
  350.             for(var8 = 1; this.fReader.skippedChar('-'); var7 = this.fReader.currentOffset()) {
  351.                ++var8;
  352.                var6 = var5;
  353.                var5 = var7;
  354.             }
  355.  
  356.             if (var8 > 1) {
  357.                if (this.fReader.skippedChar('>')) {
  358.                   if (!var3 && var8 > 2) {
  359.                      this.fErrorHandler.error(21);
  360.                      var3 = true;
  361.                   }
  362.  
  363.                   --this.fScannerMarkupDepth;
  364.                   if (var1 && this.fDocumentHandler != null) {
  365.                      this.fDocumentHandler.comment(this.fReader.addString(var2, var6 - var2));
  366.                   }
  367.  
  368.                   if (var3) {
  369.                      return false;
  370.                   }
  371.  
  372.                   return true;
  373.                }
  374.  
  375.                if (!var3) {
  376.                   this.fErrorHandler.error(22);
  377.                   var3 = true;
  378.                }
  379.             }
  380.          } else {
  381.             try {
  382.                if (!this.fReader.skippedValidChar()) {
  383.                   this.fReader.skipInvalidChar(85);
  384.                }
  385.             } catch (ArrayIndexOutOfBoundsException var9) {
  386.                if ((this.fEntityStackDepth == 0 ? 0 : this.fEntityNameStack[this.fEntityStackDepth - 1]) == 0) {
  387.                   this.fErrorHandler.error(21);
  388.                }
  389.  
  390.                throw var9;
  391.             }
  392.          }
  393.       }
  394.    }
  395.  
  396.    private void scanProlog() throws Exception {
  397.       boolean var1 = true;
  398.  
  399.       while(true) {
  400.          if (this.fReader.skippedChar('<')) {
  401.             ++this.fScannerMarkupDepth;
  402.             if (this.fReader.skippedChar('?')) {
  403.                int var2 = this.fReader.scanName(' ', -1);
  404.                if (var2 == -1) {
  405.                   this.fErrorHandler.error(102);
  406.                   this.fReader.skipPastChar('>');
  407.                   --this.fScannerMarkupDepth;
  408.                } else if ("xml".equals(this.fStringPool.toString(var2))) {
  409.                   if (this.fReader.skippedSpace()) {
  410.                      if (var1) {
  411.                         this.scanXMLDecl();
  412.                      } else {
  413.                         this.fErrorHandler.error(117);
  414.                         this.fReader.skipPastChar('>');
  415.                         --this.fScannerMarkupDepth;
  416.                      }
  417.                   } else {
  418.                      this.fErrorHandler.error(107);
  419.                      this.fReader.skipPastChar('>');
  420.                      --this.fScannerMarkupDepth;
  421.                   }
  422.                } else {
  423.                   if (this.fDocumentHandler != null && !this.fCalledStartDocument) {
  424.                      this.fDocumentHandler.startDocument(-1, -1, -1);
  425.                      this.fCalledStartDocument = true;
  426.                   }
  427.  
  428.                   this.scanPI(var2, true);
  429.                }
  430.             } else {
  431.                if (!this.fReader.skippedChar('!')) {
  432.                   if (this.fDocumentHandler != null && !this.fCalledStartDocument) {
  433.                      this.fDocumentHandler.startDocument(-1, -1, -1);
  434.                      this.fCalledStartDocument = true;
  435.                   }
  436.  
  437.                   return;
  438.                }
  439.  
  440.                if (this.fDocumentHandler != null && !this.fCalledStartDocument) {
  441.                   this.fDocumentHandler.startDocument(-1, -1, -1);
  442.                   this.fCalledStartDocument = true;
  443.                }
  444.  
  445.                if (this.fReader.skippedChar('-')) {
  446.                   if (this.fReader.skippedChar('-')) {
  447.                      this.scanComment(true);
  448.                   } else {
  449.                      this.fErrorHandler.error(20);
  450.                      this.fReader.skipPastChar('>');
  451.                      --this.fScannerMarkupDepth;
  452.                   }
  453.                } else if (this.fReader.skippedString(doctype_string)) {
  454.                   this.scanDoctypeDecl();
  455.                } else {
  456.                   this.fErrorHandler.error(39);
  457.                   this.fReader.skipPastChar('>');
  458.                   --this.fScannerMarkupDepth;
  459.                }
  460.             }
  461.          } else if (this.fReader.skippedSpace()) {
  462.             this.fReader.skipPastSpaces();
  463.          } else {
  464.             this.fErrorHandler.error(116);
  465.             this.fReader.skipToChar('<');
  466.          }
  467.  
  468.          if (this.fDocumentHandler != null && !this.fCalledStartDocument) {
  469.             this.fDocumentHandler.startDocument(-1, -1, -1);
  470.             this.fCalledStartDocument = true;
  471.          }
  472.  
  473.          var1 = false;
  474.       }
  475.    }
  476.  
  477.    private void scanXMLDecl() throws Exception {
  478.       int var1 = -1;
  479.       int var2 = -1;
  480.       int var3 = -1;
  481.       int var4 = this.fReader.skipPastSpaces();
  482.       if (!this.fReader.skippedString(version_string)) {
  483.          this.fErrorHandler.error(146);
  484.          this.fReader.skipPastChar('>');
  485.          --this.fScannerMarkupDepth;
  486.       } else {
  487.          int var5 = this.fReader.currentOffset() - var4;
  488.          this.fReader.skipPastSpaces();
  489.          if (this.fReader.skippedChar('=')) {
  490.             this.fReader.skipPastSpaces();
  491.             if (true) {
  492.                boolean var16;
  493.                if (!(var16 = this.fReader.skippedChar('\'')) && !this.fReader.skippedChar('"')) {
  494.                   this.fErrorHandler.error(16);
  495.                   this.fReader.skipPastChar('>');
  496.                   --this.fScannerMarkupDepth;
  497.                   return;
  498.                }
  499.  
  500.                int var7 = this.fReader.currentOffset();
  501.                int var8 = var16 ? 39 : 34;
  502.  
  503.                while(!this.fReader.lookingAtChar((char)var8)) {
  504.                   if (!this.fReader.skippedVersionNum()) {
  505.                      while(!this.fReader.lookingAtChar((char)var8) && !this.fReader.lookingAtChar('<')) {
  506.                         this.fReader.skipOneChar();
  507.                      }
  508.  
  509.                      if (this.fReader.lookingAtChar('<')) {
  510.                         this.fErrorHandler.error(17);
  511.                      } else {
  512.                         int var9 = this.fReader.addString(var7, this.fReader.currentOffset() - var7);
  513.                         this.fErrorHandler.error1(151, var9);
  514.                      }
  515.  
  516.                      this.fReader.skipPastChar('>');
  517.                      --this.fScannerMarkupDepth;
  518.                      return;
  519.                   }
  520.                }
  521.  
  522.                var1 = this.fReader.addString(var7, this.fReader.currentOffset() - var7);
  523.                String var23 = this.fStringPool.toString(var1);
  524.                if (!"1.0".equals(var23)) {
  525.                   this.fErrorHandler.error(149);
  526.                }
  527.  
  528.                this.fReader.skipAsciiChar();
  529.                if (!this.fReader.skippedSpace()) {
  530.                   if (!this.fReader.skippedChar('?')) {
  531.                      this.fErrorHandler.error(145);
  532.                      this.fReader.skipPastChar('>');
  533.                      --this.fScannerMarkupDepth;
  534.                      return;
  535.                   }
  536.  
  537.                   if (!this.fReader.skippedChar('>')) {
  538.                      this.fErrorHandler.error(145);
  539.                      this.fReader.skipPastChar('>');
  540.                      --this.fScannerMarkupDepth;
  541.                      return;
  542.                   }
  543.  
  544.                   --this.fScannerMarkupDepth;
  545.                   if (this.fDocumentHandler != null) {
  546.                      this.fDocumentHandler.startDocument(var1, var2, var3);
  547.                      this.fCalledStartDocument = true;
  548.                   }
  549.  
  550.                   return;
  551.                }
  552.  
  553.                int var10;
  554.                int var11;
  555.                label224: {
  556.                   var10 = this.fReader.skipPastSpaces();
  557.                   if (this.fReader.skippedString(encoding_string)) {
  558.                      var11 = this.fReader.currentOffset() - var10;
  559.                      this.fReader.skipPastSpaces();
  560.                      if (!this.fReader.skippedChar('=')) {
  561.                         break label224;
  562.                      }
  563.  
  564.                      this.fReader.skipPastSpaces();
  565.                      if (false) {
  566.                         break label224;
  567.                      }
  568.  
  569.                      if (!(var16 = this.fReader.skippedChar('\'')) && !this.fReader.skippedChar('"')) {
  570.                         this.fErrorHandler.error(16);
  571.                         this.fReader.skipPastChar('>');
  572.                         --this.fScannerMarkupDepth;
  573.                         return;
  574.                      }
  575.  
  576.                      var7 = this.fReader.currentOffset();
  577.                      var8 = var16 ? 39 : 34;
  578.                      if (!this.fReader.skippedAlpha()) {
  579.                         while(!this.fReader.lookingAtChar((char)var8) && !this.fReader.lookingAtChar('<')) {
  580.                            this.fReader.skipOneChar();
  581.                         }
  582.  
  583.                         if (this.fReader.lookingAtChar('<')) {
  584.                            this.fErrorHandler.error(17);
  585.                         } else {
  586.                            int var26 = this.fReader.addString(var7, this.fReader.currentOffset() - var7);
  587.                            this.fErrorHandler.error1(106, var26);
  588.                         }
  589.  
  590.                         this.fReader.skipPastChar('>');
  591.                         --this.fScannerMarkupDepth;
  592.                         return;
  593.                      }
  594.  
  595.                      while(!this.fReader.lookingAtChar((char)var8)) {
  596.                         if (!this.fReader.skippedEncName()) {
  597.                            while(!this.fReader.lookingAtChar((char)var8) && !this.fReader.lookingAtChar('<')) {
  598.                               this.fReader.skipOneChar();
  599.                            }
  600.  
  601.                            if (this.fReader.lookingAtChar('<')) {
  602.                               this.fErrorHandler.error(17);
  603.                            } else {
  604.                               int var12 = this.fReader.addString(var7, this.fReader.currentOffset() - var7);
  605.                               this.fErrorHandler.error1(106, var12);
  606.                            }
  607.  
  608.                            this.fReader.skipPastChar('>');
  609.                            --this.fScannerMarkupDepth;
  610.                            return;
  611.                         }
  612.                      }
  613.  
  614.                      var2 = this.fReader.addString(var7, this.fReader.currentOffset() - var7);
  615.                      this.fReader.skipAsciiChar();
  616.                      if (!this.fReader.skippedSpace()) {
  617.                         if (!this.fReader.skippedChar('?')) {
  618.                            this.fErrorHandler.error(145);
  619.                            this.fReader.skipPastChar('>');
  620.                            --this.fScannerMarkupDepth;
  621.                            return;
  622.                         }
  623.  
  624.                         if (!this.fReader.skippedChar('>')) {
  625.                            this.fErrorHandler.error(145);
  626.                            this.fReader.skipPastChar('>');
  627.                            --this.fScannerMarkupDepth;
  628.                            return;
  629.                         }
  630.  
  631.                         --this.fScannerMarkupDepth;
  632.                         if (this.fDocumentHandler != null) {
  633.                            this.fDocumentHandler.startDocument(var1, var2, var3);
  634.                            this.fCalledStartDocument = true;
  635.                         }
  636.  
  637.                         return;
  638.                      }
  639.                   }
  640.  
  641.                   int var25;
  642.                   label244: {
  643.                      var11 = this.fReader.skipPastSpaces();
  644.                      if (this.fReader.skippedString(standalone_string)) {
  645.                         var25 = this.fReader.currentOffset() - var11;
  646.                         this.fReader.skipPastSpaces();
  647.                         if (!this.fReader.skippedChar('=')) {
  648.                            break label244;
  649.                         }
  650.  
  651.                         this.fReader.skipPastSpaces();
  652.                         if (false) {
  653.                            break label244;
  654.                         }
  655.  
  656.                         if (!(var16 = this.fReader.skippedChar('\'')) && !this.fReader.skippedChar('"')) {
  657.                            this.fErrorHandler.error(16);
  658.                            this.fReader.skipPastChar('>');
  659.                            --this.fScannerMarkupDepth;
  660.                            return;
  661.                         }
  662.  
  663.                         var7 = this.fReader.currentOffset();
  664.                         var8 = var16 ? 39 : 34;
  665.                         boolean var13;
  666.                         if (!(var13 = this.fReader.skippedString(yes_string)) && !this.fReader.skippedString(no_string) || !this.fReader.lookingAtChar((char)var8)) {
  667.                            while(!this.fReader.lookingAtChar((char)var8) && !this.fReader.lookingAtChar('<')) {
  668.                               this.fReader.skipOneChar();
  669.                            }
  670.  
  671.                            if (this.fReader.lookingAtChar('<')) {
  672.                               this.fErrorHandler.error(17);
  673.                            } else {
  674.                               int var14 = this.fReader.addString(var7, this.fReader.currentOffset() - var7);
  675.                               this.fErrorHandler.error1(106, var14);
  676.                            }
  677.  
  678.                            this.fReader.skipPastChar('>');
  679.                            --this.fScannerMarkupDepth;
  680.                            return;
  681.                         }
  682.  
  683.                         this.fStandalone = var13;
  684.                         var3 = this.fReader.addString(var7, this.fReader.currentOffset() - var7);
  685.                         this.fReader.skipAsciiChar();
  686.                      }
  687.  
  688.                      this.fReader.skipPastSpaces();
  689.                      if (!this.fReader.skippedChar('?')) {
  690.                         this.fErrorHandler.error(145);
  691.                         this.fReader.skipPastChar('>');
  692.                         --this.fScannerMarkupDepth;
  693.                         return;
  694.                      }
  695.  
  696.                      if (!this.fReader.skippedChar('>')) {
  697.                         this.fErrorHandler.error(145);
  698.                         this.fReader.skipPastChar('>');
  699.                         --this.fScannerMarkupDepth;
  700.                         return;
  701.                      }
  702.  
  703.                      --this.fScannerMarkupDepth;
  704.                      if (this.fDocumentHandler != null) {
  705.                         this.fDocumentHandler.startDocument(var1, var2, var3);
  706.                         this.fCalledStartDocument = true;
  707.                      }
  708.  
  709.                      return;
  710.                   }
  711.  
  712.                   int var28 = this.fReader.addString(var11, var25);
  713.                   this.fErrorHandler.error1(8, var28);
  714.                   this.fReader.skipPastChar('>');
  715.                   --this.fScannerMarkupDepth;
  716.                   return;
  717.                }
  718.  
  719.                int var27 = this.fReader.addString(var10, var11);
  720.                this.fErrorHandler.error1(8, var27);
  721.                this.fReader.skipPastChar('>');
  722.                --this.fScannerMarkupDepth;
  723.                return;
  724.             }
  725.          }
  726.  
  727.          int var6 = this.fReader.addString(var4, var5);
  728.          this.fErrorHandler.error1(8, var6);
  729.          this.fReader.skipPastChar('>');
  730.          --this.fScannerMarkupDepth;
  731.       }
  732.    }
  733.  
  734.    private boolean scanElement(int var1) throws Exception {
  735.       if (this.fStop) {
  736.          throw new StopException(this);
  737.       } else {
  738.          int var5;
  739.          label108: {
  740.             boolean var2 = false;
  741.             int var3 = -1;
  742.             int var4 = -1;
  743.             if (this.fReader.skippedSpace()) {
  744.                while(true) {
  745.                   this.fReader.skipPastSpaces();
  746.                   if ((var2 = this.fReader.skippedChar('>')) || this.fReader.skippedChar('/')) {
  747.                      break;
  748.                   }
  749.  
  750.                   var5 = this.fReader.scanName('=', -1);
  751.                   if (var5 == -1) {
  752.                      this.fErrorHandler.error(123);
  753.                      this.fReader.skipPastChar('>');
  754.                      --this.fScannerMarkupDepth;
  755.                      return false;
  756.                   }
  757.  
  758.                   this.fReader.skipPastSpaces();
  759.                   if (!this.fReader.skippedChar('=')) {
  760.                      break label108;
  761.                   }
  762.  
  763.                   this.fReader.skipPastSpaces();
  764.                   if (false) {
  765.                      break label108;
  766.                   }
  767.  
  768.                   int var6 = this.fElementDeclPool.getAttDef(var1, var5);
  769.                   boolean var8 = false;
  770.                   int var7;
  771.                   if (var6 != -1) {
  772.                      var7 = this.fElementDeclPool.getAttType(var6);
  773.                      var8 = this.fElementDeclPool.getAttDefaultType(var6) == 4;
  774.                   } else {
  775.                      if (this.fValidationHandler != null) {
  776.                         this.fErrorHandler.error2(127, var5, var1);
  777.                      }
  778.  
  779.                      var7 = 0;
  780.                   }
  781.  
  782.                   if (!this.scanAttValue(var1, var5, var7, true, var8, false)) {
  783.                      this.fReader.skipPastChar('>');
  784.                      --this.fScannerMarkupDepth;
  785.                      return false;
  786.                   }
  787.  
  788.                   this.fAttr.attName = var5;
  789.                   this.fAttr.attType = var7;
  790.                   this.fAttr.attValue = this.fAttValueIndex;
  791.                   this.fAttr.specified = true;
  792.                   int var9 = this.fAttrPool.addAttr(this.fAttr, var3);
  793.                   if (var9 != -1) {
  794.                      var4 = var9;
  795.                      if (var3 == -1) {
  796.                         var3 = var9;
  797.                      }
  798.                   }
  799.                }
  800.             } else if (!(var2 = this.fReader.skippedChar('>')) && !this.fReader.skippedChar('/')) {
  801.                this.fErrorHandler.error(123);
  802.                this.fReader.skipPastChar('>');
  803.                --this.fScannerMarkupDepth;
  804.                return false;
  805.             }
  806.  
  807.             var5 = this.fElementDeclPool.addElement(var1);
  808.             var3 = this.fElementDeclPool.addDefaultAttributes(var5, this.fAttrPool, var3, var4);
  809.             if (this.fValidationHandler != null) {
  810.                this.fValidationHandler.checkAttributes(var5, var3);
  811.             }
  812.  
  813.             if (this.fDocumentHandler != null) {
  814.                this.fDocumentHandler.startElement(var1, var3);
  815.             } else {
  816.                this.fAttrPool.releaseAttrList(var3);
  817.             }
  818.  
  819.             if (!var2) {
  820.                if (!this.fReader.skippedChar('>')) {
  821.                   this.fErrorHandler.error(123);
  822.                   this.fReader.skipPastChar('>');
  823.                   --this.fScannerMarkupDepth;
  824.                   return false;
  825.                }
  826.  
  827.                --this.fScannerMarkupDepth;
  828.                this.pushElementName(var1);
  829.                if (this.fDocumentHandler != null) {
  830.                   this.fDocumentHandler.endElement(var1);
  831.                }
  832.  
  833.                if (this.fValidationHandler != null) {
  834.                   int var14 = this.fElementChildCount[this.fElementDepth];
  835.                   int var15 = this.fValidationHandler.checkContent(var5, var14, this.fElementChildren[this.fElementDepth]);
  836.                   if (var15 != -1) {
  837.                      String var16 = this.fElementDeclPool.getContentSpecAsString(var5);
  838.                      int var17 = var15 != var14 ? 27 : 164;
  839.                      int var10 = this.fStringPool.addString(var16);
  840.                      this.fErrorHandler.error2(var17, var1, var10);
  841.                   }
  842.                }
  843.  
  844.                if (this.fElementDepth < 0) {
  845.                   throw new RuntimeException("Element stack underflow");
  846.                }
  847.  
  848.                --this.fElementDepth;
  849.                return true;
  850.             }
  851.  
  852.             --this.fScannerMarkupDepth;
  853.             this.pushElementName(var1);
  854.             return true;
  855.          }
  856.  
  857.          this.fErrorHandler.error1(8, var5);
  858.          this.fReader.skipPastChar('>');
  859.          --this.fScannerMarkupDepth;
  860.          return false;
  861.       }
  862.    }
  863.  
  864.    private void scanContent(ScanContentState var1) throws Exception {
  865.       while(true) {
  866.          int var2 = this.fReader.scanContent(var1);
  867.          if ((var2 & 8) != 0) {
  868.             if (this.fValidationHandler != null && (var2 & 16) == 0) {
  869.                this.charDataInContent();
  870.             }
  871.  
  872.             var1.parseTextDecl = false;
  873.          }
  874.  
  875.          switch (var2 & 7) {
  876.             case 1:
  877.                ++this.fScannerMarkupDepth;
  878.                int var3 = this.fReader.scanName('>', -1);
  879.                if (var3 != -1) {
  880.                   this.scanElement(var3);
  881.                } else if (this.fReader.skippedChar('/')) {
  882.                   if (var1.extParsedEnt && this.fElementDepth == var1.elementDepth) {
  883.                      this.fErrorHandler.error(137);
  884.                   }
  885.  
  886.                   var3 = this.fElementNameStack[this.fElementDepth];
  887.                   int var4 = this.fReader.scanName('>', var3);
  888.                   if (var4 == -1) {
  889.                      this.fErrorHandler.error1(124, var3);
  890.                      this.fReader.skipPastChar('>');
  891.                      --this.fScannerMarkupDepth;
  892.                   } else {
  893.                      if (!this.fReader.skippedChar('>')) {
  894.                         this.fReader.skipPastSpaces();
  895.                         if (!this.fReader.skippedChar('>')) {
  896.                            this.fErrorHandler.error1(125, var4);
  897.                         }
  898.                      }
  899.  
  900.                      --this.fScannerMarkupDepth;
  901.                      if (this.fDocumentHandler != null) {
  902.                         this.fDocumentHandler.endElement(var3);
  903.                      }
  904.  
  905.                      if (this.fValidationHandler != null) {
  906.                         int var5 = this.fElementDeclPool.getElement(var3);
  907.                         int var6 = this.fElementChildCount[this.fElementDepth];
  908.                         var2 = this.fValidationHandler.checkContent(var5, var6, this.fElementChildren[this.fElementDepth]);
  909.                         if (var2 != -1) {
  910.                            String var7 = this.fElementDeclPool.getContentSpecAsString(var5);
  911.                            int var8 = var2 != var6 ? 27 : 164;
  912.                            int var9 = this.fStringPool.addString(var7);
  913.                            this.fErrorHandler.error2(var8, var3, var9);
  914.                         }
  915.                      }
  916.  
  917.                      if (this.fElementDepth < 0) {
  918.                         throw new RuntimeException("Element stack underflow");
  919.                      }
  920.  
  921.                      if (--this.fElementDepth < 0 && true) {
  922.                         return;
  923.                      }
  924.                   }
  925.                } else if (this.fReader.skippedChar('!')) {
  926.                   if (this.fReader.skippedChar('-')) {
  927.                      if (this.fReader.skippedChar('-')) {
  928.                         this.scanComment(true);
  929.                      } else {
  930.                         this.fErrorHandler.error(20);
  931.                         this.fReader.skipPastChar('>');
  932.                         --this.fScannerMarkupDepth;
  933.                      }
  934.                   } else if (this.fReader.skippedChar('[')) {
  935.                      if (this.fReader.skippedString(cdata_string)) {
  936.                         if (this.fReader.skippedChar('[')) {
  937.                            var1.inCDSect = true;
  938.                            --this.fScannerMarkupDepth;
  939.                         } else {
  940.                            this.fErrorHandler.error(18);
  941.                            this.fReader.skipPastChar('>');
  942.                            --this.fScannerMarkupDepth;
  943.                         }
  944.                      } else {
  945.                         this.fErrorHandler.error(18);
  946.                         this.fReader.skipPastChar('>');
  947.                         --this.fScannerMarkupDepth;
  948.                      }
  949.                   } else {
  950.                      this.fErrorHandler.error(0);
  951.                      this.fReader.skipPastChar('>');
  952.                      --this.fScannerMarkupDepth;
  953.                   }
  954.                } else if (this.fReader.skippedChar('?')) {
  955.                   int var13 = this.fReader.scanName(' ', -1);
  956.                   if (var13 == -1) {
  957.                      this.fErrorHandler.error(102);
  958.                      this.fReader.skipPastChar('>');
  959.                      --this.fScannerMarkupDepth;
  960.                   } else if ("xml".equals(this.fStringPool.toString(var13))) {
  961.                      if (this.fReader.skippedSpace()) {
  962.                         if (var1.parseTextDecl) {
  963.                            this.scanTextDecl();
  964.                         } else {
  965.                            this.fErrorHandler.error(117);
  966.                            this.fReader.skipPastChar('>');
  967.                            --this.fScannerMarkupDepth;
  968.                         }
  969.                      } else {
  970.                         this.fErrorHandler.error(107);
  971.                         this.fReader.skipPastChar('>');
  972.                         --this.fScannerMarkupDepth;
  973.                      }
  974.                   } else {
  975.                      this.scanPI(var13, true);
  976.                   }
  977.                } else {
  978.                   this.fErrorHandler.error(122);
  979.                }
  980.                break;
  981.             case 2:
  982.                this.referenceInContent(this.fReader.currentOffset());
  983.                break;
  984.             case 3:
  985.                this.fErrorHandler.error(140);
  986.                break;
  987.             case 4:
  988.                try {
  989.                   this.fReader.lookingAtValidChar();
  990.                } catch (ArrayIndexOutOfBoundsException var10) {
  991.                   if (var1.inCDSect) {
  992.                      this.fErrorHandler.error(19);
  993.                   }
  994.  
  995.                   throw var10;
  996.                }
  997.  
  998.                this.fReader.skipInvalidChar(85);
  999.          }
  1000.  
  1001.          var1.parseTextDecl = false;
  1002.       }
  1003.    }
  1004.  
  1005.    private boolean scanAttValueCDATA(boolean var1, boolean var2) throws Exception {
  1006.       boolean var3;
  1007.       if (!(var3 = this.fReader.skippedChar('\'')) && !this.fReader.skippedChar('"')) {
  1008.          this.fErrorHandler.error(16);
  1009.          return false;
  1010.       } else {
  1011.          int var4 = var3 ? 39 : 34;
  1012.          int var5 = this.fReader.currentOffset();
  1013.          int var6 = var5;
  1014.          int var7 = var1 ? this.fLiteralData.length() : 0;
  1015.          int var8 = 0;
  1016.  
  1017.          while(true) {
  1018.             boolean var9 = false;
  1019.             boolean var10 = false;
  1020.             if (var8 == 0) {
  1021.                while(true) {
  1022.                   try {
  1023.                      var9 = this.fReader.skippedChar((char)var4);
  1024.                      break;
  1025.                   } catch (ArrayIndexOutOfBoundsException var16) {
  1026.                      if (var1 && var5 - var6 > 0) {
  1027.                         this.fReader.append(this.fLiteralData, var6, var5 - var6);
  1028.                      }
  1029.  
  1030.                      this.popReader();
  1031.                      --this.fEntityStackDepth;
  1032.                      var5 = this.fReader.currentOffset();
  1033.                      var6 = var5;
  1034.                   }
  1035.                }
  1036.  
  1037.                if (var9) {
  1038.                   if (var1) {
  1039.                      int var19 = this.fLiteralData.length() - var7;
  1040.                      if (var19 == 0) {
  1041.                         if (var2) {
  1042.                            this.fAttValueIndex = this.fReader.addSymbol(var6, var5 - var6);
  1043.                         } else {
  1044.                            this.fAttValueIndex = this.fReader.addString(var6, var5 - var6);
  1045.                         }
  1046.                      } else {
  1047.                         if (var5 - var6 > 0) {
  1048.                            this.fReader.append(this.fLiteralData, var6, var5 - var6);
  1049.                            var19 = this.fLiteralData.length() - var7;
  1050.                         }
  1051.  
  1052.                         if (var2) {
  1053.                            this.fAttValueIndex = this.fLiteralData.addSymbol(var7, var19);
  1054.                         } else {
  1055.                            this.fAttValueIndex = this.fLiteralData.addString(var7, var19);
  1056.                         }
  1057.                      }
  1058.                   }
  1059.  
  1060.                   return true;
  1061.                }
  1062.             }
  1063.  
  1064.             try {
  1065.                var9 = this.fReader.skippedChar(' ');
  1066.             } catch (ArrayIndexOutOfBoundsException var17) {
  1067.                if (var1 && var5 - var6 > 0) {
  1068.                   this.fReader.append(this.fLiteralData, var6, var5 - var6);
  1069.                }
  1070.  
  1071.                this.popReader();
  1072.                --this.fEntityStackDepth;
  1073.                --var8;
  1074.                var10 = true;
  1075.                var5 = this.fReader.currentOffset();
  1076.                var6 = var5;
  1077.             }
  1078.  
  1079.             if (!var10) {
  1080.                if (var9) {
  1081.                   var5 = this.fReader.currentOffset();
  1082.                } else if (this.fReader.skippedSpace()) {
  1083.                   if (var1) {
  1084.                      if (var5 - var6 > 0) {
  1085.                         this.fReader.append(this.fLiteralData, var6, var5 - var6);
  1086.                      }
  1087.  
  1088.                      this.fLiteralData.append(' ');
  1089.                   }
  1090.  
  1091.                   var5 = this.fReader.currentOffset();
  1092.                   var6 = var5;
  1093.                } else if (this.fReader.skippedChar('&')) {
  1094.                   if (var1 && var5 - var6 > 0) {
  1095.                      this.fReader.append(this.fLiteralData, var6, var5 - var6);
  1096.                   }
  1097.  
  1098.                   if (this.fReader.skippedChar('#')) {
  1099.                      int var11 = this.scanCharRef();
  1100.                      if (var11 == -1) {
  1101.                         while(var8-- > 0) {
  1102.                            this.popReader();
  1103.                            --this.fEntityStackDepth;
  1104.                         }
  1105.  
  1106.                         this.fReader.skipPastChar((char)var4);
  1107.                         return false;
  1108.                      }
  1109.  
  1110.                      if (var1) {
  1111.                         if (var11 < 65536) {
  1112.                            this.fLiteralData.append((char)var11);
  1113.                         } else {
  1114.                            this.fLiteralData.append((char)((var11 - 65536 >> 10) + '\ud800'));
  1115.                            this.fLiteralData.append((char)((var11 - 65536 & 1023) + '\udc00'));
  1116.                         }
  1117.                      }
  1118.  
  1119.                      var5 = this.fReader.currentOffset();
  1120.                      var6 = var5;
  1121.                   } else {
  1122.                      int var18 = this.fReader.currentOffset();
  1123.                      int var12 = this.fReader.skipPastName(';') - var18;
  1124.                      if (var12 == 0) {
  1125.                         this.fReader.skipInvalidChar(110);
  1126.  
  1127.                         while(var8-- > 0) {
  1128.                            this.popReader();
  1129.                            --this.fEntityStackDepth;
  1130.                         }
  1131.  
  1132.                         this.fReader.skipPastChar((char)var4);
  1133.                         return false;
  1134.                      }
  1135.  
  1136.                      if (!this.fReader.skippedChar(';')) {
  1137.                         this.fErrorHandler.error(111);
  1138.  
  1139.                         while(var8-- > 0) {
  1140.                            this.popReader();
  1141.                            --this.fEntityStackDepth;
  1142.                         }
  1143.  
  1144.                         this.fReader.skipPastChar((char)var4);
  1145.                         return false;
  1146.                      }
  1147.  
  1148.                      int var13 = this.fReader.addSymbol(var18, var12);
  1149.                      int var14 = this.fEntityPool.lookupEntity(var13);
  1150.                      if (var14 < 0) {
  1151.                         this.fErrorHandler.error1(60, var13);
  1152.  
  1153.                         while(var8-- > 0) {
  1154.                            this.popReader();
  1155.                            --this.fEntityStackDepth;
  1156.                         }
  1157.  
  1158.                         this.fReader.skipPastChar((char)var4);
  1159.                         return false;
  1160.                      }
  1161.  
  1162.                      if (this.fEntityPool.isExternal(var14)) {
  1163.                         this.fErrorHandler.error1(67, var13);
  1164.  
  1165.                         while(var8-- > 0) {
  1166.                            this.popReader();
  1167.                            --this.fEntityStackDepth;
  1168.                         }
  1169.  
  1170.                         this.fReader.skipPastChar((char)var4);
  1171.                         return false;
  1172.                      }
  1173.  
  1174.                      if (!this.pushEntity((byte)0, var13)) {
  1175.                         while(var8-- > 0) {
  1176.                            this.popReader();
  1177.                            --this.fEntityStackDepth;
  1178.                         }
  1179.  
  1180.                         this.fReader.skipPastChar((char)var4);
  1181.                         return false;
  1182.                      }
  1183.  
  1184.                      StringReader var15 = new StringReader(this.fParserState, false, this.fReader, this.fEntityPool.getEntityValue(var14));
  1185.                      this.pushReader(var15, (InputSource)null);
  1186.                      ++var8;
  1187.                      var5 = this.fReader.currentOffset();
  1188.                      var6 = var5;
  1189.                   }
  1190.                } else {
  1191.                   if (this.fReader.skippedChar('<')) {
  1192.                      this.fErrorHandler.error(17);
  1193.  
  1194.                      while(var8-- > 0) {
  1195.                         this.popReader();
  1196.                         --this.fEntityStackDepth;
  1197.                      }
  1198.  
  1199.                      this.fReader.skipPastChar((char)var4);
  1200.                      return false;
  1201.                   }
  1202.  
  1203.                   if (!this.fReader.skippedValidChar()) {
  1204.                      this.fReader.skipInvalidChar(85);
  1205.  
  1206.                      while(var8-- > 0) {
  1207.                         this.popReader();
  1208.                         --this.fEntityStackDepth;
  1209.                      }
  1210.  
  1211.                      this.fReader.skipPastChar((char)var4);
  1212.                      return false;
  1213.                   }
  1214.  
  1215.                   var5 = this.fReader.currentOffset();
  1216.                }
  1217.             }
  1218.          }
  1219.       }
  1220.    }
  1221.  
  1222.    private boolean scanNormalizedAttValue(char var1) throws Exception {
  1223.       int var2 = 0;
  1224.       this.fLiteralData.length();
  1225.  
  1226.       while(true) {
  1227.          try {
  1228.             while(this.fReader.skippedChar('&')) {
  1229.                if (this.fReader.skippedChar('#')) {
  1230.                   int var3 = this.scanCharRef();
  1231.                   if (var3 == -1) {
  1232.                      this.fReader.skipPastChar(var1);
  1233.                      return false;
  1234.                   }
  1235.  
  1236.                   if (var3 < 65536) {
  1237.                      this.fLiteralData.append((char)var3);
  1238.                   } else {
  1239.                      this.fLiteralData.append((char)((var3 - 65536 >> 10) + '\ud800'));
  1240.                      this.fLiteralData.append((char)((var3 - 65536 & 1023) + '\udc00'));
  1241.                   }
  1242.                } else {
  1243.                   int var9 = this.fReader.currentOffset();
  1244.                   int var4 = this.fReader.skipPastName(';') - var9;
  1245.                   if (var4 == 0) {
  1246.                      this.fReader.skipInvalidChar(110);
  1247.                      this.fReader.skipPastChar(var1);
  1248.                      return false;
  1249.                   }
  1250.  
  1251.                   if (!this.fReader.skippedChar(';')) {
  1252.                      this.fErrorHandler.error(111);
  1253.                      this.fReader.skipPastChar(var1);
  1254.                      return false;
  1255.                   }
  1256.  
  1257.                   int var5 = this.fReader.addSymbol(var9, var4);
  1258.                   int var6 = this.fEntityPool.lookupEntity(var5);
  1259.                   if (var6 < 0) {
  1260.                      this.fErrorHandler.error1(60, var5);
  1261.                      this.fReader.skipPastChar(var1);
  1262.                      return false;
  1263.                   }
  1264.  
  1265.                   if (this.fEntityPool.isExternal(var6)) {
  1266.                      this.fErrorHandler.error1(67, var5);
  1267.                      this.fReader.skipPastChar(var1);
  1268.                      return false;
  1269.                   }
  1270.  
  1271.                   if (!this.pushEntity((byte)0, var5)) {
  1272.                      this.fReader.skipPastChar(var1);
  1273.                      return false;
  1274.                   }
  1275.  
  1276.                   StringReader var7 = new StringReader(this.fParserState, false, this.fReader, this.fEntityPool.getEntityValue(var6));
  1277.                   this.pushReader(var7, (InputSource)null);
  1278.                   ++var2;
  1279.                }
  1280.             }
  1281.  
  1282.             if (!this.fReader.skippedSpace()) {
  1283.                if (this.fReader.lookingAtChar(var1)) {
  1284.                   if (var2 == 0) {
  1285.                      this.fReader.skipAsciiChar();
  1286.                      this.fLiteralData.append(var1);
  1287.                      return true;
  1288.                   }
  1289.  
  1290.                   this.fReader.skipInvalidChar(85);
  1291.  
  1292.                   while(var2-- > 0) {
  1293.                      this.popReader();
  1294.                      --this.fEntityStackDepth;
  1295.                   }
  1296.  
  1297.                   this.fReader.skipPastChar(var1);
  1298.                   return false;
  1299.                }
  1300.  
  1301.                int var10 = this.fReader.currentOffset();
  1302.                int var11 = this.fReader.skipOneChar() - var10;
  1303.                this.fReader.append(this.fLiteralData, var10, var11);
  1304.             } else {
  1305.                this.fReader.skipPastSpaces();
  1306.                this.fLiteralData.append(' ');
  1307.             }
  1308.          } catch (ArrayIndexOutOfBoundsException var8) {
  1309.             this.popReader();
  1310.             --var2;
  1311.             --this.fEntityStackDepth;
  1312.          }
  1313.       }
  1314.    }
  1315.  
  1316.    private boolean scanAttValue(int var1, int var2, int var3, boolean var4, boolean var5, boolean var6) throws Exception {
  1317.       if (var3 == 0) {
  1318.          return this.scanAttValueCDATA(var4, var5);
  1319.       } else {
  1320.          boolean var7;
  1321.          if (!(var7 = this.fReader.skippedChar('\'')) && !this.fReader.skippedChar('"')) {
  1322.             if (!var6) {
  1323.                this.fErrorHandler.error(16);
  1324.             }
  1325.  
  1326.             return false;
  1327.          } else {
  1328.             int var8 = var7 ? 39 : 34;
  1329.             boolean var9 = true;
  1330.             boolean var10 = var3 != 3 && var3 != 5 && var3 != 7;
  1331.             boolean var11 = var3 != 6 && var3 != 7 && var3 != 9;
  1332.             boolean var12 = false;
  1333.             boolean var13 = false;
  1334.             int var14 = this.fReader.skipPastSpaces();
  1335.             int var15 = this.fLiteralData.length();
  1336.  
  1337.             while(true) {
  1338.                int var16 = this.fReader.currentOffset();
  1339.                int var17 = (var11 ? this.fReader.skipPastName((char)var8) : this.fReader.skipPastNmtoken((char)var8)) - var16;
  1340.                if (var17 == 0) {
  1341.                   if (var12) {
  1342.                      this.fReader.skipInvalidChar(85);
  1343.                      this.popReader();
  1344.                      return false;
  1345.                   }
  1346.  
  1347.                   if (this.fReader.skippedChar((char)var8)) {
  1348.                      if (!var6) {
  1349.                         this.fErrorHandler.error1(142, var2);
  1350.                      }
  1351.  
  1352.                      return false;
  1353.                   }
  1354.  
  1355.                   if (var16 - var14 > 0) {
  1356.                      this.fReader.append(this.fLiteralData, var14, var16 - var14);
  1357.                   }
  1358.  
  1359.                   var14 = -1;
  1360.                   int var18 = this.fLiteralData.length();
  1361.                   if (!this.scanNormalizedAttValue((char)var8)) {
  1362.                      return false;
  1363.                   }
  1364.  
  1365.                   int var19 = this.fLiteralData.addString(var18, this.fLiteralData.length() - var18);
  1366.                   StringReader var20 = new StringReader(this.fParserState, false, this.fReader, var19);
  1367.                   this.pushReader(var20, (InputSource)null);
  1368.                   var12 = true;
  1369.                   this.fLiteralData.setLength(var18);
  1370.                   var16 = this.fReader.skipPastSpaces();
  1371.                   if (this.fReader.skippedChar((char)var8)) {
  1372.                      if (var9) {
  1373.                         if (!var6) {
  1374.                            this.fErrorHandler.error1(142, var2);
  1375.                         }
  1376.  
  1377.                         this.popReader();
  1378.                         return false;
  1379.                      }
  1380.  
  1381.                      if (var5) {
  1382.                         this.fAttValueIndex = this.fLiteralData.addSymbol(var15, var18 - var15);
  1383.                      } else {
  1384.                         this.fAttValueIndex = this.fLiteralData.addString(var15, var18 - var15);
  1385.                      }
  1386.  
  1387.                      this.popReader();
  1388.                      return true;
  1389.                   }
  1390.  
  1391.                   var17 = (var11 ? this.fReader.skipPastName((char)var8) : this.fReader.skipPastNmtoken((char)var8)) - var16;
  1392.                   if (var17 == 0) {
  1393.                      this.fReader.skipInvalidChar(85);
  1394.                      this.popReader();
  1395.                      return false;
  1396.                   }
  1397.                }
  1398.  
  1399.                boolean var31;
  1400.                int var32;
  1401.                if (var12) {
  1402.                   int var33 = this.fLiteralData.length();
  1403.                   this.fReader.append(this.fLiteralData, var16, var17);
  1404.                   int var21 = this.fLiteralData.length();
  1405.                   boolean var22 = this.fReader.skippedSpace();
  1406.                   if (var22) {
  1407.                      this.fReader.skipPastSpaces();
  1408.                   }
  1409.  
  1410.                   var31 = this.fReader.skippedChar((char)var8);
  1411.                   if (var31) {
  1412.                      var32 = this.fLiteralData.addSymbol(var33, var21 - var33);
  1413.                      if (var9) {
  1414.                         this.fAttValueIndex = var32;
  1415.                      } else if (var5) {
  1416.                         this.fAttValueIndex = this.fLiteralData.addSymbol(var15, var21 - var15);
  1417.                      } else {
  1418.                         this.fAttValueIndex = this.fLiteralData.addString(var15, var21 - var15);
  1419.                      }
  1420.  
  1421.                      this.popReader();
  1422.                   } else {
  1423.                      if (!var22) {
  1424.                         this.fReader.skipInvalidChar(85);
  1425.                         this.popReader();
  1426.                         return false;
  1427.                      }
  1428.  
  1429.                      if (var10) {
  1430.                         this.fReader.skipInvalidChar(85);
  1431.                         this.popReader();
  1432.                         return false;
  1433.                      }
  1434.  
  1435.                      var32 = this.fLiteralData.addSymbol(var33, var21 - var33);
  1436.                      this.fLiteralData.append(' ');
  1437.                      var16 = this.fReader.currentOffset();
  1438.                   }
  1439.                } else {
  1440.                   boolean var34 = false;
  1441.                   boolean var36 = this.fReader.skippedChar(' ');
  1442.                   if (this.fReader.skippedSpace()) {
  1443.                      this.fReader.skipPastSpaces();
  1444.                      var36 = true;
  1445.                      var34 = true;
  1446.                   }
  1447.  
  1448.                   var31 = this.fReader.skippedChar((char)var8);
  1449.                   if (var31) {
  1450.                      if (var13) {
  1451.                         int var39 = this.fLiteralData.length();
  1452.                         this.fReader.append(this.fLiteralData, var16, var17);
  1453.                         int var23 = this.fLiteralData.length();
  1454.                         var32 = this.fLiteralData.addSymbol(var39, var23 - var39);
  1455.                         if (var5) {
  1456.                            this.fAttValueIndex = this.fLiteralData.addSymbol(var15, var23 - var15);
  1457.                         } else {
  1458.                            this.fAttValueIndex = this.fLiteralData.addString(var15, var23 - var15);
  1459.                         }
  1460.                      } else {
  1461.                         var32 = this.fReader.addSymbol(var16, var17);
  1462.                         if (var9) {
  1463.                            this.fAttValueIndex = var32;
  1464.                         } else if (var5) {
  1465.                            this.fAttValueIndex = this.fReader.addSymbol(var14, var16 + var17 - var14);
  1466.                         } else {
  1467.                            this.fAttValueIndex = this.fReader.addString(var14, var16 + var17 - var14);
  1468.                         }
  1469.                      }
  1470.                   } else if (var36) {
  1471.                      if (var10 && !var31) {
  1472.                         this.fReader.skipInvalidChar(85);
  1473.                         this.fReader.skipPastChar((char)var8);
  1474.                         return false;
  1475.                      }
  1476.  
  1477.                      if (var13) {
  1478.                         int var40 = this.fLiteralData.length();
  1479.                         this.fReader.append(this.fLiteralData, var16, var17);
  1480.                         int var45 = this.fLiteralData.length();
  1481.                         var32 = this.fLiteralData.addSymbol(var40, var45 - var40);
  1482.                         this.fLiteralData.append(' ');
  1483.                      } else if (var34) {
  1484.                         if (var16 - var14 > 0) {
  1485.                            this.fReader.append(this.fLiteralData, var14, var16 - var14);
  1486.                         }
  1487.  
  1488.                         var14 = -1;
  1489.                         int var41 = this.fLiteralData.length();
  1490.                         this.fReader.append(this.fLiteralData, var16, var17);
  1491.                         int var46 = this.fLiteralData.length();
  1492.                         var32 = this.fLiteralData.addSymbol(var41, var46 - var41);
  1493.                         this.fLiteralData.append(' ');
  1494.                         var13 = true;
  1495.                      } else {
  1496.                         var32 = this.fReader.addSymbol(var16, var17);
  1497.                      }
  1498.                   } else {
  1499.                      if (var16 - var14 > 0) {
  1500.                         this.fReader.append(this.fLiteralData, var14, var16 - var14);
  1501.                      }
  1502.  
  1503.                      var14 = -1;
  1504.                      int var42 = this.fLiteralData.length();
  1505.                      this.fReader.append(this.fLiteralData, var16, var17);
  1506.                      if (!this.scanNormalizedAttValue((char)var8)) {
  1507.                         return false;
  1508.                      }
  1509.  
  1510.                      int var47 = this.fLiteralData.addString(var42, this.fLiteralData.length() - var42);
  1511.                      StringReader var24 = new StringReader(this.fParserState, false, this.fReader, var47);
  1512.                      this.pushReader(var24, (InputSource)null);
  1513.                      var12 = true;
  1514.                      this.fLiteralData.setLength(var42);
  1515.                      var16 = this.fReader.currentOffset();
  1516.                      var17 = (var11 ? this.fReader.skipPastName((char)var8) : this.fReader.skipPastNmtoken((char)var8)) - var16;
  1517.                      int var25 = this.fLiteralData.length();
  1518.                      this.fReader.append(this.fLiteralData, var16, var17);
  1519.                      int var26 = this.fLiteralData.length();
  1520.                      var36 = this.fReader.skippedSpace();
  1521.                      if (var36) {
  1522.                         this.fReader.skipPastSpaces();
  1523.                      }
  1524.  
  1525.                      var31 = this.fReader.skippedChar((char)var8);
  1526.                      if (var31) {
  1527.                         var32 = this.fLiteralData.addSymbol(var25, var26 - var25);
  1528.                         if (var9) {
  1529.                            this.fAttValueIndex = var32;
  1530.                         } else if (var5) {
  1531.                            this.fAttValueIndex = this.fLiteralData.addSymbol(var15, var26 - var15);
  1532.                         } else {
  1533.                            this.fAttValueIndex = this.fLiteralData.addString(var15, var26 - var15);
  1534.                         }
  1535.  
  1536.                         this.popReader();
  1537.                      } else {
  1538.                         if (!var36) {
  1539.                            this.fReader.skipInvalidChar(85);
  1540.                            this.popReader();
  1541.                            return false;
  1542.                         }
  1543.  
  1544.                         if (var10) {
  1545.                            this.fReader.skipInvalidChar(85);
  1546.                            this.popReader();
  1547.                            return false;
  1548.                         }
  1549.  
  1550.                         var32 = this.fLiteralData.addSymbol(var25, var26 - var25);
  1551.                         this.fLiteralData.append(' ');
  1552.                         var16 = this.fReader.currentOffset();
  1553.                      }
  1554.                   }
  1555.                }
  1556.  
  1557.                switch (var3) {
  1558.                   case 1:
  1559.                      if (this.fValidationHandler != null && !this.fElementDeclPool.addId(var32, var1)) {
  1560.                         this.fErrorHandler.error1(129, var32);
  1561.                      }
  1562.  
  1563.                      return true;
  1564.                   case 2:
  1565.                   case 3:
  1566.                      if (var1 != -1 && this.fValidationHandler != null) {
  1567.                         this.fElementDeclPool.addIdRef(var32, var1);
  1568.                      }
  1569.  
  1570.                      if (var31) {
  1571.                         return true;
  1572.                      }
  1573.                      break;
  1574.                   case 4:
  1575.                   case 5:
  1576.                      int var35 = this.fEntityPool.lookupEntity(var32);
  1577.                      if (this.fValidationHandler != null && var35 == -1 || !this.fEntityPool.isUnparsed(var35)) {
  1578.                         this.fErrorHandler.error1(131, var32);
  1579.                         if (!var31) {
  1580.                            this.fReader.skipPastChar((char)var8);
  1581.                         }
  1582.                      }
  1583.  
  1584.                      if (var31) {
  1585.                         return true;
  1586.                      }
  1587.                      break;
  1588.                   case 6:
  1589.                   case 7:
  1590.                      if (var31) {
  1591.                         return true;
  1592.                      }
  1593.                      break;
  1594.                   case 8:
  1595.                   case 9:
  1596.                      int var38;
  1597.                      if (var1 == -1) {
  1598.                         var38 = this.fAttDef.enumeration;
  1599.                      } else {
  1600.                         int var43 = this.fElementDeclPool.getAttDef(var1, var2);
  1601.                         var38 = this.fElementDeclPool.getEnumeration(var43);
  1602.                      }
  1603.  
  1604.                      if (this.fValidationHandler != null && !this.fStringPool.stringInList(var38, var32)) {
  1605.                         int[] var44 = this.fStringPool.stringsInList(var38);
  1606.                         StringBuffer var48 = new StringBuffer();
  1607.                         int var49 = var44.length;
  1608.  
  1609.                         for(int var50 = 0; var50 < var49; ++var50) {
  1610.                            var48.append(this.fStringPool.toString(var44[var50]));
  1611.                            if (var50 < var49 - 1) {
  1612.                               var48.append(",");
  1613.                            }
  1614.                         }
  1615.  
  1616.                         int var51 = this.fStringPool.addSymbol(var48.toString());
  1617.                         this.fErrorHandler.error2(161, var32, var51);
  1618.                      }
  1619.  
  1620.                      return true;
  1621.                }
  1622.  
  1623.                var9 = false;
  1624.             }
  1625.          }
  1626.       }
  1627.    }
  1628.  
  1629.    private int referenceInEntityValue(int var1, boolean var2) throws Exception {
  1630.       if (this.fReader.skippedChar('#')) {
  1631.          int var5 = this.scanCharRef();
  1632.          if (var5 == -1) {
  1633.             return this.fReader.currentOffset();
  1634.          } else {
  1635.             if (var2) {
  1636.                if (var5 < 65536) {
  1637.                   this.fLiteralData.append((char)var5);
  1638.                } else {
  1639.                   this.fLiteralData.append((char)((var5 - 65536 >> 10) + '\ud800'));
  1640.                   this.fLiteralData.append((char)((var5 - 65536 & 1023) + '\udc00'));
  1641.                }
  1642.             }
  1643.  
  1644.             return this.fReader.currentOffset();
  1645.          }
  1646.       } else {
  1647.          int var3 = this.fReader.currentOffset();
  1648.          int var4 = this.fReader.skipPastName(';') - var3;
  1649.          if (var4 == 0) {
  1650.             this.fReader.skipInvalidChar(110);
  1651.             return this.fReader.currentOffset();
  1652.          } else if (!this.fReader.skippedChar(';')) {
  1653.             this.fErrorHandler.error(111);
  1654.             return this.fReader.currentOffset();
  1655.          } else {
  1656.             if (var2) {
  1657.                this.fReader.append(this.fLiteralData, var1, this.fReader.currentOffset() - var1);
  1658.             }
  1659.  
  1660.             return this.fReader.currentOffset();
  1661.          }
  1662.       }
  1663.    }
  1664.  
  1665.    private boolean referenceInContent(int var1) throws Exception {
  1666.       if (this.fReader.skippedChar('#')) {
  1667.          int var14 = this.scanCharRef();
  1668.          if (var14 == -1) {
  1669.             return false;
  1670.          } else {
  1671.             if (this.fDocumentHandler != null) {
  1672.                if (this.fCharRefData == null) {
  1673.                   this.fCharRefData = new char[2];
  1674.                }
  1675.  
  1676.                int var15 = var14 < 65536 ? 1 : 2;
  1677.                if (var15 == 1) {
  1678.                   this.fCharRefData[0] = (char)var14;
  1679.                } else {
  1680.                   this.fCharRefData[0] = (char)((var14 - 65536 >> 10) + '\ud800');
  1681.                   this.fCharRefData[1] = (char)((var14 - 65536 & 1023) + '\udc00');
  1682.                }
  1683.  
  1684.                if (!this.fDocumentHandler.sendCharDataAsCharArray()) {
  1685.                   int var16 = this.fStringPool.addString(new String(this.fCharRefData, 0, var15));
  1686.                   this.fDocumentHandler.characters(var16, false);
  1687.                } else {
  1688.                   this.fDocumentHandler.characters(this.fCharRefData, 0, var15, false);
  1689.                }
  1690.             }
  1691.  
  1692.             return true;
  1693.          }
  1694.       } else {
  1695.          int var2 = this.fReader.currentOffset();
  1696.          int var3 = this.fReader.skipPastName(';') - var2;
  1697.          if (var3 == 0) {
  1698.             this.fReader.skipInvalidChar(110);
  1699.             return false;
  1700.          } else if (!this.fReader.skippedChar(';')) {
  1701.             this.fErrorHandler.error(111);
  1702.             return false;
  1703.          } else {
  1704.             int var4 = this.fReader.addSymbol(var2, var3);
  1705.             int var5 = this.fEntityPool.lookupEntity(var4);
  1706.             if (var5 < 0) {
  1707.                this.fErrorHandler.error1(60, var4);
  1708.                return false;
  1709.             } else if (this.fEntityPool.isUnparsed(var5)) {
  1710.                this.fErrorHandler.error1(62, var4);
  1711.                return false;
  1712.             } else if (!this.pushEntity((byte)0, var4)) {
  1713.                return false;
  1714.             } else {
  1715.                if (this.fDocumentHandler != null) {
  1716.                   this.fDocumentHandler.startEntityReference(var5);
  1717.                }
  1718.  
  1719.                Object var6 = null;
  1720.                InputSource var7 = null;
  1721.                if (this.fEntityPool.isExternal(var5)) {
  1722.                   int var8 = this.fEntityPool.getPublicId(var5);
  1723.                   int var9 = this.fEntityPool.getSystemId(var5);
  1724.                   var9 = this.fEntityHandler.expandSystemId(var9);
  1725.                   var7 = this.fEntityHandler.resolveEntity(var8, var9);
  1726.                   if (var7 == null) {
  1727.                      var7 = new InputSource(this.fStringPool.toString(var9));
  1728.                      if (var8 != -1) {
  1729.                         var7.setPublicId(this.fStringPool.toString(var8));
  1730.                      }
  1731.                   }
  1732.  
  1733.                   var6 = this.fEntityHandler.createReader(var7, false);
  1734.                   this.fEntityHandler.startInputSource(var7);
  1735.                } else {
  1736.                   var6 = new StringReader(this.fParserState, false, this.fReader, this.fEntityPool.getEntityValue(var5));
  1737.                }
  1738.  
  1739.                int var18 = this.pushReader((XMLReader)var6, var7);
  1740.                int var20 = this.setActiveReaderLimit(var18);
  1741.  
  1742.                try {
  1743.                   ScanContentState var10 = new ScanContentState();
  1744.                   var10.inCDSect = false;
  1745.                   var10.extParsedEnt = true;
  1746.                   var10.parseTextDecl = this.fReader.lookingAtChar('<');
  1747.                   var10.elementDepth = this.fElementDepth;
  1748.                   this.scanContent(var10);
  1749.                } catch (ArrayIndexOutOfBoundsException var11) {
  1750.                } catch (StopException var12) {
  1751.                   throw var12;
  1752.                } catch (Exception var13) {
  1753.                   throw var13;
  1754.                }
  1755.  
  1756.                this.setActiveReaderLimit(var20);
  1757.                this.popReader();
  1758.                if (this.fDocumentHandler != null) {
  1759.                   this.fDocumentHandler.endEntityReference(var5);
  1760.                }
  1761.  
  1762.                --this.fEntityStackDepth;
  1763.                return true;
  1764.             }
  1765.          }
  1766.       }
  1767.    }
  1768.  
  1769.    private int scanCharRef() throws Exception {
  1770.       boolean var1 = this.fReader.skippedChar('x');
  1771.       int var2 = this.fReader.currentOffset();
  1772.       int var3 = 0;
  1773.       int var4 = 0;
  1774.       if (var1) {
  1775.          int var5 = this.fReader.skipHexDigit();
  1776.          if (var5 < 0) {
  1777.             if (this.fReader.skippedChar(';')) {
  1778.                this.fErrorHandler.error(112);
  1779.             } else {
  1780.                this.fReader.skipInvalidChar(110);
  1781.             }
  1782.  
  1783.             return -1;
  1784.          }
  1785.  
  1786.          var4 = var5;
  1787.  
  1788.          while(true) {
  1789.             var5 = this.fReader.skipHexDigit();
  1790.             if (var5 < 0) {
  1791.                break;
  1792.             }
  1793.  
  1794.             var4 = (var4 << 4) + var5;
  1795.             if (var4 > 1114111) {
  1796.                this.fReader.skipToChar(';');
  1797.                break;
  1798.             }
  1799.          }
  1800.       } else {
  1801.          int var10 = this.fReader.skipDecimalDigit();
  1802.          if (var10 < 0) {
  1803.             if (this.fReader.skippedChar(';')) {
  1804.                this.fErrorHandler.error(112);
  1805.             } else {
  1806.                this.fReader.skipInvalidChar(110);
  1807.             }
  1808.  
  1809.             return -1;
  1810.          }
  1811.  
  1812.          var4 = var10;
  1813.  
  1814.          while(true) {
  1815.             var10 = this.fReader.skipDecimalDigit();
  1816.             if (var10 < 0) {
  1817.                break;
  1818.             }
  1819.  
  1820.             var4 = var4 * 10 + var10;
  1821.             if (var4 > 1114111) {
  1822.                this.fReader.skipToChar(';');
  1823.                break;
  1824.             }
  1825.          }
  1826.       }
  1827.  
  1828.       var3 = this.fReader.currentOffset() - var2;
  1829.       if (!this.fReader.skippedChar(';')) {
  1830.          this.fErrorHandler.error(111);
  1831.          return -1;
  1832.       } else {
  1833.          if (var4 < 32) {
  1834.             if (var4 == 9 || var4 == 10 || var4 == 13) {
  1835.                return var4;
  1836.             }
  1837.          } else if (var4 <= 55295 || var4 >= 57344 && (var4 <= 65533 || var4 >= 65536 && var4 <= 1114111)) {
  1838.             return var4;
  1839.          }
  1840.  
  1841.          int var12 = var1 ? 113 : 114;
  1842.          int var6 = this.fReader.addString(var2, var3);
  1843.          this.fErrorHandler.error1(var12, var6);
  1844.          return -1;
  1845.       }
  1846.    }
  1847.  
  1848.    private void scanMisc() throws Exception {
  1849.       while(true) {
  1850.          if (this.fReader.skippedChar('<')) {
  1851.             ++this.fScannerMarkupDepth;
  1852.             if (this.fReader.skippedChar('?')) {
  1853.                int var1 = this.fReader.scanName(' ', -1);
  1854.                if (var1 == -1) {
  1855.                   this.fErrorHandler.error(102);
  1856.                   this.fReader.skipPastChar('>');
  1857.                   --this.fScannerMarkupDepth;
  1858.                } else if ("xml".equals(this.fStringPool.toString(var1))) {
  1859.                   if (this.fReader.skippedSpace()) {
  1860.                      this.fErrorHandler.error(117);
  1861.                   } else {
  1862.                      this.fErrorHandler.error(107);
  1863.                   }
  1864.  
  1865.                   this.fReader.skipPastChar('>');
  1866.                   --this.fScannerMarkupDepth;
  1867.                } else {
  1868.                   this.scanPI(var1, true);
  1869.                }
  1870.             } else if (this.fReader.skippedChar('!')) {
  1871.                if (this.fReader.skippedChar('-')) {
  1872.                   if (this.fReader.skippedChar('-')) {
  1873.                      this.scanComment(true);
  1874.                   } else {
  1875.                      this.fErrorHandler.error(20);
  1876.                      this.fReader.skipPastChar('>');
  1877.                      --this.fScannerMarkupDepth;
  1878.                   }
  1879.                } else {
  1880.                   this.fErrorHandler.error(116);
  1881.                   this.fReader.skipPastChar('>');
  1882.                   --this.fScannerMarkupDepth;
  1883.                }
  1884.             } else {
  1885.                this.fErrorHandler.error(116);
  1886.                this.fReader.skipToChar('<');
  1887.                --this.fScannerMarkupDepth;
  1888.             }
  1889.          } else if (this.fReader.skippedSpace()) {
  1890.             this.fReader.skipPastSpaces();
  1891.          } else if (!this.fReader.lookingAtValidChar()) {
  1892.             this.fReader.skipInvalidChar(85);
  1893.          } else {
  1894.             this.fErrorHandler.error(116);
  1895.             this.fReader.skipToChar('<');
  1896.          }
  1897.       }
  1898.    }
  1899.  
  1900.    private void scanPI(int var1, boolean var2) throws Exception {
  1901.       String var3 = this.fStringPool.toString(var1);
  1902.       if (var3.length() != 3 || var3.charAt(0) != 'X' && var3.charAt(0) != 'x' || var3.charAt(1) != 'M' && var3.charAt(1) != 'm' || var3.charAt(2) != 'L' && var3.charAt(2) != 'l') {
  1903.          if (!this.fReader.skippedSpace()) {
  1904.             if (!this.fReader.skippedChar('?')) {
  1905.                this.fErrorHandler.error(105);
  1906.                this.fReader.skipPastChar('>');
  1907.                --this.fScannerMarkupDepth;
  1908.             } else if (!this.fReader.skippedChar('>')) {
  1909.                this.fErrorHandler.error(105);
  1910.                this.fReader.skipPastChar('>');
  1911.                --this.fScannerMarkupDepth;
  1912.             } else {
  1913.                --this.fScannerMarkupDepth;
  1914.                if (var2 && this.fDocumentHandler != null) {
  1915.                   this.fDocumentHandler.processingInstruction(var1, -1);
  1916.                }
  1917.  
  1918.             }
  1919.          } else {
  1920.             int var4 = this.fReader.skipPastSpaces();
  1921.  
  1922.             try {
  1923.                do {
  1924.                   while(this.fReader.lookingAtChar('?')) {
  1925.                      int var5 = this.fReader.currentOffset();
  1926.                      this.fReader.skipAsciiChar();
  1927.                      if (this.fReader.skippedChar('>')) {
  1928.                         --this.fScannerMarkupDepth;
  1929.                         if (var2 && this.fDocumentHandler != null) {
  1930.                            int var6 = -1;
  1931.                            if (var5 != var4) {
  1932.                               var6 = this.fReader.addString(var4, var5 - var4);
  1933.                            }
  1934.  
  1935.                            this.fDocumentHandler.processingInstruction(var1, var6);
  1936.                         }
  1937.  
  1938.                         return;
  1939.                      }
  1940.                   }
  1941.                } while(this.fReader.skippedValidChar());
  1942.  
  1943.                this.fReader.skipInvalidChar(85);
  1944.                this.fReader.skipPastChar('>');
  1945.                --this.fScannerMarkupDepth;
  1946.             } catch (ArrayIndexOutOfBoundsException var7) {
  1947.                if ((this.fEntityStackDepth == 0 ? 0 : this.fEntityNameStack[this.fEntityStackDepth - 1]) == 0) {
  1948.                   this.fErrorHandler.error(105);
  1949.                   throw var7;
  1950.                }
  1951.             }
  1952.          }
  1953.       } else {
  1954.          this.fErrorHandler.error(107);
  1955.          this.fReader.skipPastChar('>');
  1956.          --this.fScannerMarkupDepth;
  1957.       }
  1958.    }
  1959.  
  1960.    private void scanDoctypeDecl() throws Exception {
  1961.       if (!this.fReader.skippedSpace()) {
  1962.          this.fErrorHandler.error(115);
  1963.          this.fReader.skipPastChar('>');
  1964.          --this.fScannerMarkupDepth;
  1965.       } else {
  1966.          this.fReader.skipPastSpaces();
  1967.          int var1 = this.fReader.scanName(' ', -1);
  1968.          if (var1 == -1) {
  1969.             this.fErrorHandler.error(40);
  1970.             this.fReader.skipPastChar('>');
  1971.             --this.fScannerMarkupDepth;
  1972.          } else {
  1973.             int var2 = this.fElementDeclPool.addElement(var1);
  1974.             this.fElementDeclPool.setRootElement(var2);
  1975.             if (this.fDocumentTypeHandler != null) {
  1976.                this.fDocumentTypeHandler.doctypeDecl(var1);
  1977.             }
  1978.  
  1979.             boolean var4 = false;
  1980.             int var5 = -1;
  1981.             int var6 = -1;
  1982.             boolean var3;
  1983.             if (this.fReader.skippedSpace()) {
  1984.                this.fReader.skipPastSpaces();
  1985.                if (!(var3 = this.fReader.skippedChar('[')) && !this.fReader.lookingAtChar('>')) {
  1986.                   var4 = true;
  1987.                   if (!this.scanExternalIDorPublicID(var4, false)) {
  1988.                      this.fReader.skipPastChar('>');
  1989.                      --this.fScannerMarkupDepth;
  1990.                      return;
  1991.                   }
  1992.  
  1993.                   var5 = this.fPubidLiteral;
  1994.                   var6 = this.fSystemLiteral;
  1995.                   this.fReader.skipPastSpaces();
  1996.                   var3 = this.fReader.skippedChar('[');
  1997.                }
  1998.             } else {
  1999.                var3 = this.fReader.skippedChar('[');
  2000.             }
  2001.  
  2002.             if (var3) {
  2003.                if (!this.scanIntSubsetDecl()) {
  2004.                   this.fReader.skipPastChar('>');
  2005.                   --this.fScannerMarkupDepth;
  2006.                   return;
  2007.                }
  2008.  
  2009.                this.fReader.skipPastSpaces();
  2010.             }
  2011.  
  2012.             if (!this.fReader.skippedChar('>')) {
  2013.                this.fErrorHandler.error(125);
  2014.                this.fReader.skipPastChar('>');
  2015.                --this.fScannerMarkupDepth;
  2016.             } else {
  2017.                --this.fScannerMarkupDepth;
  2018.                if (var4) {
  2019.                   if (this.fDocumentTypeHandler != null) {
  2020.                      this.fDocumentTypeHandler.startExternalSubset(var5, var6);
  2021.                   }
  2022.  
  2023.                   int var7 = this.fScannerState;
  2024.                   this.fScannerState = 3;
  2025.                   var6 = this.fEntityHandler.expandSystemId(var6);
  2026.                   InputSource var8 = this.fEntityHandler.resolveEntity(var5, var6);
  2027.                   if (var8 == null) {
  2028.                      var8 = new InputSource(this.fStringPool.toString(var6));
  2029.                      if (var5 != -1) {
  2030.                         var8.setPublicId(this.fStringPool.toString(var5));
  2031.                      }
  2032.                   }
  2033.  
  2034.                   XMLReader var9 = this.fEntityHandler.createReader(var8, false);
  2035.                   this.fEntityHandler.startInputSource(var8);
  2036.                   int var10 = this.pushReader(var9, var8);
  2037.                   int var11 = this.setActiveReaderLimit(var10);
  2038.  
  2039.                   try {
  2040.                      this.scanExtSubsetDecl(false);
  2041.                   } catch (ArrayIndexOutOfBoundsException var13) {
  2042.                   } catch (StopException var14) {
  2043.                      throw var14;
  2044.                   } catch (Exception var15) {
  2045.                      throw var15;
  2046.                   }
  2047.  
  2048.                   this.setActiveReaderLimit(var11);
  2049.                   this.popReader();
  2050.                   this.fScannerState = var7;
  2051.                   if (this.fDocumentTypeHandler != null) {
  2052.                      this.fDocumentTypeHandler.endExternalSubset();
  2053.                   }
  2054.                }
  2055.  
  2056.                if (this.fParserState.getValidationHandler() != null) {
  2057.                   this.fElementDeclPool.checkDeclaredElements();
  2058.                }
  2059.  
  2060.             }
  2061.          }
  2062.       }
  2063.    }
  2064.  
  2065.    private boolean scanIntSubsetDecl() throws Exception {
  2066.       if (this.fDocumentTypeHandler != null) {
  2067.          this.fDocumentTypeHandler.startInternalSubset();
  2068.       }
  2069.  
  2070.       boolean var1 = true;
  2071.       int var2 = this.fScannerState;
  2072.       this.fScannerState = 2;
  2073.  
  2074.       while(!this.fReader.skippedChar(']')) {
  2075.          if (this.fReader.skippedChar('<')) {
  2076.             this.scanMarkupDecl(false);
  2077.          } else if (this.fReader.skippedSpace()) {
  2078.             this.fReader.skipPastSpaces();
  2079.          } else if (this.fReader.skippedChar('%')) {
  2080.             this.scanPEReference();
  2081.          } else {
  2082.             if (this.fReader.lookingAtChar('>')) {
  2083.                this.fReader.skipInvalidChar(43);
  2084.                return false;
  2085.             }
  2086.  
  2087.             this.fReader.lookingAtValidChar();
  2088.             this.fReader.skipInvalidChar(43);
  2089.             var1 = false;
  2090.  
  2091.             while(true) {
  2092.                this.fReader.skipOneChar();
  2093.                if (this.fReader.lookingAtChar('%') || this.fReader.lookingAtChar('<') || this.fReader.lookingAtSpace() || this.fReader.lookingAtChar(']')) {
  2094.                   break;
  2095.                }
  2096.             }
  2097.          }
  2098.       }
  2099.  
  2100.       this.fScannerState = var2;
  2101.       if (this.fDocumentTypeHandler != null) {
  2102.          this.fDocumentTypeHandler.endInternalSubset();
  2103.       }
  2104.  
  2105.       return var1;
  2106.    }
  2107.  
  2108.    private void scanTextDecl() throws Exception {
  2109.       int var3;
  2110.       int var5;
  2111.       label137: {
  2112.          var3 = this.fReader.skipPastSpaces();
  2113.          int var4;
  2114.          if (this.fReader.skippedString(version_string)) {
  2115.             var5 = this.fReader.currentOffset() - var3;
  2116.             this.fReader.skipPastSpaces();
  2117.             if (!this.fReader.skippedChar('=')) {
  2118.                break label137;
  2119.             }
  2120.  
  2121.             this.fReader.skipPastSpaces();
  2122.             if (false) {
  2123.                break label137;
  2124.             }
  2125.  
  2126.             boolean var1;
  2127.             if (!(var1 = this.fReader.skippedChar('\'')) && !this.fReader.skippedChar('"')) {
  2128.                this.fErrorHandler.error(16);
  2129.                this.fReader.skipPastChar('>');
  2130.                --this.fScannerMarkupDepth;
  2131.                return;
  2132.             }
  2133.  
  2134.             int var6 = this.fReader.currentOffset();
  2135.             int var2 = var1 ? 39 : 34;
  2136.  
  2137.             while(!this.fReader.lookingAtChar((char)var2)) {
  2138.                if (!this.fReader.skippedVersionNum()) {
  2139.                   while(!this.fReader.lookingAtChar((char)var2) && !this.fReader.lookingAtChar('<')) {
  2140.                      this.fReader.skipOneChar();
  2141.                   }
  2142.  
  2143.                   if (this.fReader.lookingAtChar('<')) {
  2144.                      this.fErrorHandler.error(17);
  2145.                   } else {
  2146.                      int var7 = this.fReader.addString(var6, this.fReader.currentOffset() - var6);
  2147.                      this.fErrorHandler.error1(151, var7);
  2148.                   }
  2149.  
  2150.                   this.fReader.skipPastChar('>');
  2151.                   --this.fScannerMarkupDepth;
  2152.                   return;
  2153.                }
  2154.             }
  2155.  
  2156.             String var14 = this.fStringPool.orphanString(this.fReader.addString(var6, this.fReader.currentOffset() - var6));
  2157.             if (!"1.0".equals(var14)) {
  2158.                this.fErrorHandler.error(149);
  2159.             }
  2160.  
  2161.             this.fReader.skipAsciiChar();
  2162.             if (!this.fReader.skippedSpace()) {
  2163.                this.fErrorHandler.error(115);
  2164.                this.fReader.skipPastChar('>');
  2165.                --this.fScannerMarkupDepth;
  2166.                return;
  2167.             }
  2168.  
  2169.             var4 = this.fReader.skipPastSpaces();
  2170.          } else {
  2171.             var4 = var3;
  2172.          }
  2173.  
  2174.          if (!this.fReader.skippedString(encoding_string)) {
  2175.             this.fErrorHandler.error(109);
  2176.             this.fReader.skipPastChar('>');
  2177.             --this.fScannerMarkupDepth;
  2178.             return;
  2179.          }
  2180.  
  2181.          var5 = this.fReader.currentOffset() - var4;
  2182.          this.fReader.skipPastSpaces();
  2183.          if (this.fReader.skippedChar('=')) {
  2184.             this.fReader.skipPastSpaces();
  2185.             if (true) {
  2186.                boolean var8;
  2187.                if (!(var8 = this.fReader.skippedChar('\'')) && !this.fReader.skippedChar('"')) {
  2188.                   this.fErrorHandler.error(16);
  2189.                   this.fReader.skipPastChar('>');
  2190.                   --this.fScannerMarkupDepth;
  2191.                   return;
  2192.                }
  2193.  
  2194.                int var13 = this.fReader.currentOffset();
  2195.                int var9 = var8 ? 39 : 34;
  2196.                if (!this.fReader.skippedAlpha()) {
  2197.                   while(!this.fReader.lookingAtChar((char)var9) && !this.fReader.lookingAtChar('<')) {
  2198.                      this.fReader.skipOneChar();
  2199.                   }
  2200.  
  2201.                   if (this.fReader.lookingAtChar('<')) {
  2202.                      this.fErrorHandler.error(17);
  2203.                   } else {
  2204.                      int var16 = this.fReader.addString(var13, this.fReader.currentOffset() - var13);
  2205.                      this.fErrorHandler.error1(106, var16);
  2206.                   }
  2207.  
  2208.                   this.fReader.skipPastChar('>');
  2209.                   --this.fScannerMarkupDepth;
  2210.                   return;
  2211.                }
  2212.  
  2213.                while(!this.fReader.lookingAtChar((char)var9)) {
  2214.                   if (!this.fReader.skippedEncName()) {
  2215.                      while(!this.fReader.lookingAtChar((char)var9) && !this.fReader.lookingAtChar('<')) {
  2216.                         this.fReader.skipOneChar();
  2217.                      }
  2218.  
  2219.                      if (this.fReader.lookingAtChar('<')) {
  2220.                         this.fErrorHandler.error(17);
  2221.                      } else {
  2222.                         int var15 = this.fReader.addString(var13, this.fReader.currentOffset() - var13);
  2223.                         this.fErrorHandler.error1(106, var15);
  2224.                      }
  2225.  
  2226.                      this.fReader.skipPastChar('>');
  2227.                      --this.fScannerMarkupDepth;
  2228.                      return;
  2229.                   }
  2230.                }
  2231.  
  2232.                this.fReader.skipAsciiChar();
  2233.                this.fReader.skipPastSpaces();
  2234.                if (!this.fReader.skippedChar('?')) {
  2235.                   this.fErrorHandler.error(105);
  2236.                   this.fReader.skipPastChar('>');
  2237.                   --this.fScannerMarkupDepth;
  2238.                   return;
  2239.                }
  2240.  
  2241.                if (!this.fReader.skippedChar('>')) {
  2242.                   this.fErrorHandler.error(105);
  2243.                   this.fReader.skipPastChar('>');
  2244.                   --this.fScannerMarkupDepth;
  2245.                   return;
  2246.                }
  2247.  
  2248.                --this.fScannerMarkupDepth;
  2249.                return;
  2250.             }
  2251.          }
  2252.  
  2253.          int var12 = this.fReader.addString(var4, var5);
  2254.          this.fErrorHandler.error1(8, var12);
  2255.          this.fReader.skipPastChar('>');
  2256.          --this.fScannerMarkupDepth;
  2257.          return;
  2258.       }
  2259.  
  2260.       int var11 = this.fReader.addString(var3, var5);
  2261.       this.fErrorHandler.error1(8, var11);
  2262.       this.fReader.skipPastChar('>');
  2263.       --this.fScannerMarkupDepth;
  2264.    }
  2265.  
  2266.    private void scanExtSubsetDecl(boolean var1) throws Exception {
  2267.       boolean var2 = !var1;
  2268.  
  2269.       try {
  2270.          while(true) {
  2271.             if (this.checkSkippedChar('<', false)) {
  2272.                this.scanMarkupDecl(var2);
  2273.             } else if (this.checkSkippedSpace()) {
  2274.                this.checkSkipPastSpaces();
  2275.             } else if (this.checkSkippedChar('%', false)) {
  2276.                this.scanPEReference();
  2277.             } else {
  2278.                if (var1 && this.checkSkippedChar(']', false)) {
  2279.                   if (!this.checkSkippedChar(']', false)) {
  2280.                      this.fErrorHandler.error(24);
  2281.                      this.fReader.skipPastChar('>');
  2282.                      --this.fScannerMarkupDepth;
  2283.                      return;
  2284.                   }
  2285.  
  2286.                   if (!this.checkSkippedChar('>', false)) {
  2287.                      this.fErrorHandler.error(24);
  2288.                      this.fReader.skipPastChar('>');
  2289.                      --this.fScannerMarkupDepth;
  2290.                      return;
  2291.                   }
  2292.  
  2293.                   --this.fScannerMarkupDepth;
  2294.                   return;
  2295.                }
  2296.  
  2297.                if (!this.fReader.lookingAtValidChar()) {
  2298.                   this.fReader.skipInvalidChar(85);
  2299.                } else {
  2300.                   this.fErrorHandler.error(116);
  2301.                }
  2302.  
  2303.                do {
  2304.                   this.fReader.skipOneChar();
  2305.                } while(!this.fReader.lookingAtChar('%') && !this.fReader.lookingAtChar('<') && (!var1 || !this.fReader.lookingAtChar(']')));
  2306.             }
  2307.  
  2308.             var2 = false;
  2309.          }
  2310.       } catch (ArrayIndexOutOfBoundsException var4) {
  2311.          if (var1) {
  2312.             this.fErrorHandler.error(24);
  2313.          }
  2314.  
  2315.          throw var4;
  2316.       }
  2317.    }
  2318.  
  2319.    private boolean scanExternalID(boolean var1) throws Exception {
  2320.       return this.scanExternalIDorPublicID(var1, false);
  2321.    }
  2322.  
  2323.    private boolean scanExternalIDorPublicID(boolean var1) throws Exception {
  2324.       return this.scanExternalIDorPublicID(var1, true);
  2325.    }
  2326.  
  2327.    private boolean scanExternalIDorPublicID(boolean var1, boolean var2) throws Exception {
  2328.       this.fSystemLiteral = -1;
  2329.       this.fPubidLiteral = -1;
  2330.       int var3 = this.fReader.currentOffset();
  2331.       if (this.fReader.skippedString(system_string)) {
  2332.          if (!this.fReader.skippedSpace()) {
  2333.             this.fErrorHandler.error(115);
  2334.             return false;
  2335.          } else {
  2336.             this.fReader.skipPastSpaces();
  2337.             return this.scanSystemLiteral(var1);
  2338.          }
  2339.       } else if (this.fReader.skippedString(public_string)) {
  2340.          if (!this.fReader.skippedSpace()) {
  2341.             this.fErrorHandler.error(115);
  2342.             return false;
  2343.          } else {
  2344.             this.fReader.skipPastSpaces();
  2345.             if (!this.scanPubidLiteral(var1)) {
  2346.                return false;
  2347.             } else {
  2348.                if (var2) {
  2349.                   if (!this.fReader.skippedSpace()) {
  2350.                      return true;
  2351.                   }
  2352.  
  2353.                   this.fReader.skipPastSpaces();
  2354.                   if (this.fReader.lookingAtChar('>')) {
  2355.                      return true;
  2356.                   }
  2357.                } else {
  2358.                   if (!this.fReader.skippedSpace()) {
  2359.                      this.fErrorHandler.error(115);
  2360.                      return false;
  2361.                   }
  2362.  
  2363.                   this.fReader.skipPastSpaces();
  2364.                }
  2365.  
  2366.                return this.scanSystemLiteral(var1);
  2367.             }
  2368.          }
  2369.       } else {
  2370.          int var4 = this.fReader.skipPastNmtoken(' ') - var3;
  2371.          int var5 = this.fReader.addString(var3, var4);
  2372.          this.fErrorHandler.error1(41, var5);
  2373.          return false;
  2374.       }
  2375.    }
  2376.  
  2377.    private boolean scanSystemLiteral(boolean var1) throws Exception {
  2378.       boolean var2;
  2379.       if (!(var2 = this.fReader.skippedChar('\'')) && !this.fReader.skippedChar('"')) {
  2380.          this.fErrorHandler.error(81);
  2381.          return false;
  2382.       } else {
  2383.          int var3 = this.fReader.currentOffset();
  2384.          int var4 = var2 ? 39 : 34;
  2385.  
  2386.          while(!this.fReader.lookingAtChar((char)var4)) {
  2387.             if (!this.fReader.skippedValidChar()) {
  2388.                this.fReader.skipInvalidChar(82);
  2389.                this.fReader.skipPastChar((char)var4);
  2390.                return false;
  2391.             }
  2392.          }
  2393.  
  2394.          if (var1) {
  2395.             this.fSystemLiteral = this.fReader.addString(var3, this.fReader.currentOffset() - var3);
  2396.          }
  2397.  
  2398.          this.fReader.skipAsciiChar();
  2399.          return true;
  2400.       }
  2401.    }
  2402.  
  2403.    private boolean scanPubidLiteral(boolean var1) throws Exception {
  2404.       boolean var2;
  2405.       if (!(var2 = this.fReader.skippedChar('\'')) && !this.fReader.skippedChar('"')) {
  2406.          this.fErrorHandler.error(79);
  2407.          return false;
  2408.       } else {
  2409.          int var3 = var2 ? 39 : 34;
  2410.          int var4 = this.fReader.skipPastSpaces();
  2411.          int var5 = var1 ? this.fLiteralData.length() : 0;
  2412.          int var6 = var4;
  2413.  
  2414.          while(true) {
  2415.             if (this.fReader.skippedChar((char)var3)) {
  2416.                if (var1 && var4 - var6 > 0) {
  2417.                   this.fReader.append(this.fLiteralData, var6, var4 - var6);
  2418.                }
  2419.                break;
  2420.             }
  2421.  
  2422.             if (this.fReader.skippedSpace()) {
  2423.                if (var1 && var4 - var6 > 0) {
  2424.                   this.fReader.append(this.fLiteralData, var6, var4 - var6);
  2425.                }
  2426.  
  2427.                var4 = this.fReader.skipPastSpaces();
  2428.                var6 = var4;
  2429.                if (this.fReader.skippedChar((char)var3)) {
  2430.                   break;
  2431.                }
  2432.  
  2433.                if (var1) {
  2434.                   this.fLiteralData.append(' ');
  2435.                }
  2436.             }
  2437.  
  2438.             if (!this.fReader.skippedPubidChar()) {
  2439.                this.fReader.skipInvalidChar(80);
  2440.                this.fReader.skipPastChar((char)var3);
  2441.                return false;
  2442.             }
  2443.  
  2444.             var4 = this.fReader.currentOffset();
  2445.          }
  2446.  
  2447.          if (var1) {
  2448.             int var7 = this.fLiteralData.length() - var5;
  2449.             this.fPubidLiteral = this.fLiteralData.addString(var5, var7);
  2450.          }
  2451.  
  2452.          return true;
  2453.       }
  2454.    }
  2455.  
  2456.    private void scanPEReference() throws Exception {
  2457.       int var1 = this.fReader.currentOffset();
  2458.       int var2 = this.fReader.skipPastName(';') - var1;
  2459.       if (var2 == 0) {
  2460.          this.fErrorHandler.error(92);
  2461.       } else if (!this.fReader.skippedChar(';')) {
  2462.          int var13 = this.fReader.addString(var1, var2);
  2463.          this.fErrorHandler.error1(93, var13);
  2464.       } else {
  2465.          int var3 = this.fReader.addSymbol(var1, var2);
  2466.          int var4 = this.fParameterEntityPool == null ? -1 : this.fParameterEntityPool.lookupEntity(var3);
  2467.          if (var4 < 0) {
  2468.             this.fErrorHandler.error1(94, var3);
  2469.          } else {
  2470.             this.fDocumentTypeHandler.parameterEntityDecl(var4);
  2471.             if (this.pushEntity((byte)1, var3)) {
  2472.                Object var5 = null;
  2473.                InputSource var6 = null;
  2474.                if (this.fParameterEntityPool.isExternal(var4)) {
  2475.                   int var7 = this.fParameterEntityPool.getPublicId(var4);
  2476.                   int var8 = this.fParameterEntityPool.getSystemId(var4);
  2477.                   var8 = this.fEntityHandler.expandSystemId(var8);
  2478.                   var6 = this.fEntityHandler.resolveEntity(var7, var8);
  2479.                   if (var6 == null) {
  2480.                      var6 = new InputSource(this.fStringPool.toString(var8));
  2481.                      if (var7 != -1) {
  2482.                         var6.setPublicId(this.fStringPool.toString(var7));
  2483.                      }
  2484.                   }
  2485.  
  2486.                   var5 = this.fEntityHandler.createReader(var6, false);
  2487.                   this.fEntityHandler.startInputSource(var6);
  2488.                } else {
  2489.                   var5 = new StringReader(this.fParserState, true, this.fReader, this.fParameterEntityPool.getEntityValue(var4));
  2490.                }
  2491.  
  2492.                int var15 = this.pushReader((XMLReader)var5, var6);
  2493.                int var17 = this.setActiveReaderLimit(var15);
  2494.  
  2495.                try {
  2496.                   this.scanExtSubsetDecl(false);
  2497.                } catch (ArrayIndexOutOfBoundsException var10) {
  2498.                } catch (StopException var11) {
  2499.                   throw var11;
  2500.                } catch (Exception var12) {
  2501.                   throw var12;
  2502.                }
  2503.  
  2504.                this.setActiveReaderLimit(var17);
  2505.                this.popReader();
  2506.                --this.fEntityStackDepth;
  2507.             }
  2508.          }
  2509.       }
  2510.    }
  2511.  
  2512.    private boolean copyPEReference() throws Exception {
  2513.       int var1 = this.fReader.currentOffset();
  2514.       int var2 = this.fReader.skipPastName(';') - var1;
  2515.       if (var2 == 0) {
  2516.          this.fErrorHandler.error(92);
  2517.          return false;
  2518.       } else if (!this.fReader.skippedChar(';')) {
  2519.          int var17 = this.fReader.addString(var1, var2);
  2520.          this.fErrorHandler.error1(93, var17);
  2521.          return false;
  2522.       } else {
  2523.          int var3 = this.fReader.addSymbol(var1, var2);
  2524.          int var4 = this.fParameterEntityPool == null ? -1 : this.fParameterEntityPool.lookupEntity(var3);
  2525.          if (var4 < 0) {
  2526.             this.fErrorHandler.error1(94, var3);
  2527.             return false;
  2528.          } else {
  2529.             this.fDocumentTypeHandler.parameterEntityDecl(var4);
  2530.             if (!this.fParameterEntityPool.isExternal(var4)) {
  2531.                this.fLiteralData.append(this.fStringPool.toString(this.fParameterEntityPool.getEntityValue(var4)));
  2532.                return true;
  2533.             } else if (!this.pushEntity((byte)1, var3)) {
  2534.                return false;
  2535.             } else {
  2536.                int var5 = this.fParameterEntityPool.getPublicId(var4);
  2537.                int var6 = this.fParameterEntityPool.getSystemId(var4);
  2538.                var6 = this.fEntityHandler.expandSystemId(var6);
  2539.                InputSource var7 = this.fEntityHandler.resolveEntity(var5, var6);
  2540.                if (var7 == null) {
  2541.                   var7 = new InputSource(this.fStringPool.toString(var6));
  2542.                   if (var5 != -1) {
  2543.                      var7.setPublicId(this.fStringPool.toString(var5));
  2544.                   }
  2545.                }
  2546.  
  2547.                XMLReader var8 = this.fEntityHandler.createReader(var7, false);
  2548.                this.fEntityHandler.startInputSource(var7);
  2549.                int var9 = this.pushReader(var8, var7);
  2550.                int var10 = this.setActiveReaderLimit(var9);
  2551.                int var11 = this.fReader.currentOffset();
  2552.                boolean var12 = true;
  2553.  
  2554.                try {
  2555.                   while(this.fReader.skippedValidChar()) {
  2556.                   }
  2557.  
  2558.                   this.fReader.skipInvalidChar(63);
  2559.                   var12 = false;
  2560.                } catch (ArrayIndexOutOfBoundsException var14) {
  2561.                } catch (StopException var15) {
  2562.                   throw var15;
  2563.                } catch (Exception var16) {
  2564.                   throw var16;
  2565.                }
  2566.  
  2567.                if (var12) {
  2568.                   this.fReader.append(this.fLiteralData, var11, this.fReader.currentOffset() - var11);
  2569.                }
  2570.  
  2571.                this.setActiveReaderLimit(var10);
  2572.                this.popReader();
  2573.                --this.fEntityStackDepth;
  2574.                return var12;
  2575.             }
  2576.          }
  2577.       }
  2578.    }
  2579.  
  2580.    private void expandPEReference() throws Exception {
  2581.       int var1 = this.fReader.currentOffset();
  2582.       int var2 = this.fReader.skipPastName(';') - var1;
  2583.       if (var2 == 0) {
  2584.          this.fErrorHandler.error(92);
  2585.       }
  2586.  
  2587.       if (!this.fReader.skippedChar(';')) {
  2588.          int var3 = this.fReader.addString(var1, var2);
  2589.          this.fErrorHandler.error1(93, var3);
  2590.       }
  2591.  
  2592.       int var9 = this.fReader.addSymbol(var1, var2);
  2593.       int var4 = this.fParameterEntityPool.lookupEntity(var9);
  2594.       if (var4 < 0) {
  2595.          this.fErrorHandler.error1(94, var9);
  2596.       } else {
  2597.          this.fDocumentTypeHandler.parameterEntityDecl(var4);
  2598.          if (this.pushEntity((byte)1, var9)) {
  2599.             if (!this.fParameterEntityPool.isExternal(var4)) {
  2600.                StringReader var10 = new StringReader(this.fParserState, true, this.fReader, this.fParameterEntityPool.getEntityValue(var4));
  2601.                this.pushReader(var10, (InputSource)null);
  2602.             } else {
  2603.                int var5 = this.fParameterEntityPool.getPublicId(var4);
  2604.                int var6 = this.fParameterEntityPool.getSystemId(var4);
  2605.                var6 = this.fEntityHandler.expandSystemId(var6);
  2606.                InputSource var7 = this.fEntityHandler.resolveEntity(var5, var6);
  2607.                if (var7 == null) {
  2608.                   var7 = new InputSource(this.fStringPool.toString(var6));
  2609.                   if (var5 != -1) {
  2610.                      var7.setPublicId(this.fStringPool.toString(var5));
  2611.                   }
  2612.                }
  2613.  
  2614.                XMLReader var8 = this.fEntityHandler.createReader(var7, false);
  2615.                this.fEntityHandler.startInputSource(var7);
  2616.                this.pushReader(var8, var7);
  2617.             }
  2618.          }
  2619.       }
  2620.    }
  2621.  
  2622.    private boolean checkSkippedChar(char var1, boolean var2) throws Exception {
  2623.       while(true) {
  2624.          try {
  2625.             boolean var3 = this.fReader.skippedChar(var1);
  2626.             return var3;
  2627.          } catch (ArrayIndexOutOfBoundsException var4) {
  2628.             this.popReader();
  2629.             --this.fEntityStackDepth;
  2630.             if (var2) {
  2631.                this.fReader.skipPastSpaces();
  2632.             }
  2633.          }
  2634.       }
  2635.    }
  2636.  
  2637.    private boolean checkSkippedSpace() throws Exception {
  2638.       while(true) {
  2639.          try {
  2640.             boolean var1 = this.fReader.skippedSpace();
  2641.             return var1;
  2642.          } catch (ArrayIndexOutOfBoundsException var2) {
  2643.             this.popReader();
  2644.             --this.fEntityStackDepth;
  2645.          }
  2646.       }
  2647.    }
  2648.  
  2649.    private int checkSkipPastSpaces() throws Exception {
  2650.       while(true) {
  2651.          try {
  2652.             int var1 = this.fReader.skipPastSpaces();
  2653.             return var1;
  2654.          } catch (ArrayIndexOutOfBoundsException var2) {
  2655.             this.popReader();
  2656.             --this.fEntityStackDepth;
  2657.          }
  2658.       }
  2659.    }
  2660.  
  2661.    private boolean checkForPEReference(boolean var1) throws Exception {
  2662.       boolean var2 = true;
  2663.       if (var1) {
  2664.          try {
  2665.             var2 = this.fReader.skippedSpace();
  2666.          } catch (ArrayIndexOutOfBoundsException var7) {
  2667.             this.popReader();
  2668.             --this.fEntityStackDepth;
  2669.             var2 = this.fReader.skippedSpace();
  2670.             if (var2) {
  2671.                this.fReader.skipPastSpaces();
  2672.             }
  2673.          }
  2674.       }
  2675.  
  2676.       while(true) {
  2677.          try {
  2678.             this.fReader.skipPastSpaces();
  2679.             break;
  2680.          } catch (ArrayIndexOutOfBoundsException var6) {
  2681.             this.popReader();
  2682.             --this.fEntityStackDepth;
  2683.             if (!var2) {
  2684.                var2 = this.fReader.skippedSpace();
  2685.             }
  2686.          }
  2687.       }
  2688.  
  2689.       if (this.fScannerState != 3) {
  2690.          return var2;
  2691.       } else {
  2692.          boolean var3;
  2693.          while(true) {
  2694.             try {
  2695.                var3 = this.fReader.skippedChar('%');
  2696.                break;
  2697.             } catch (ArrayIndexOutOfBoundsException var5) {
  2698.                this.popReader();
  2699.                --this.fEntityStackDepth;
  2700.                if (!var2) {
  2701.                   var2 = this.fReader.skippedSpace();
  2702.                }
  2703.  
  2704.                if (var2) {
  2705.                   this.fReader.skipPastSpaces();
  2706.                }
  2707.             }
  2708.          }
  2709.  
  2710.          if (!var3) {
  2711.             return var2;
  2712.          } else {
  2713.             while(true) {
  2714.                this.expandPEReference();
  2715.  
  2716.                while(true) {
  2717.                   try {
  2718.                      this.fReader.skipPastSpaces();
  2719.                   } catch (ArrayIndexOutOfBoundsException var4) {
  2720.                      this.popReader();
  2721.                      --this.fEntityStackDepth;
  2722.                      continue;
  2723.                   }
  2724.  
  2725.                   var3 = this.checkSkippedChar('%', true);
  2726.                   if (!var3) {
  2727.                      return true;
  2728.                   }
  2729.                   break;
  2730.                }
  2731.             }
  2732.          }
  2733.       }
  2734.    }
  2735.  
  2736.    private boolean checkForPEDecl() throws Exception {
  2737.       boolean var1 = this.checkSkippedSpace();
  2738.       if (var1) {
  2739.          while(true) {
  2740.             try {
  2741.                this.fReader.skipPastSpaces();
  2742.                break;
  2743.             } catch (ArrayIndexOutOfBoundsException var10) {
  2744.                this.popReader();
  2745.                --this.fEntityStackDepth;
  2746.                var1 = this.fReader.skippedSpace();
  2747.                if (var1) {
  2748.                   this.fReader.skipPastSpaces();
  2749.                }
  2750.             }
  2751.          }
  2752.       }
  2753.  
  2754.       boolean var2;
  2755.       while(true) {
  2756.          try {
  2757.             var2 = this.fReader.skippedChar('%');
  2758.             break;
  2759.          } catch (ArrayIndexOutOfBoundsException var9) {
  2760.             this.popReader();
  2761.             --this.fEntityStackDepth;
  2762.             var1 = this.fReader.skippedSpace();
  2763.             if (var1) {
  2764.                this.fReader.skipPastSpaces();
  2765.             }
  2766.          }
  2767.       }
  2768.  
  2769.       if (!var2) {
  2770.          if (!var1) {
  2771.             this.fErrorHandler.error(115);
  2772.          }
  2773.  
  2774.          return false;
  2775.       } else if (this.fScannerState != 3 && !var1) {
  2776.          this.fErrorHandler.error(115);
  2777.          return false;
  2778.       } else {
  2779.          try {
  2780.             var1 = this.fReader.skippedSpace();
  2781.          } catch (ArrayIndexOutOfBoundsException var8) {
  2782.             this.popReader();
  2783.             --this.fEntityStackDepth;
  2784.             var1 = this.fReader.skippedSpace();
  2785.             if (var1) {
  2786.                this.fReader.skipPastSpaces();
  2787.             }
  2788.          }
  2789.  
  2790.          if (var1) {
  2791.             this.checkForPEReference(false);
  2792.             return true;
  2793.          } else if (this.fScannerState != 3) {
  2794.             this.fErrorHandler.error(115);
  2795.             return true;
  2796.          } else {
  2797.             while(true) {
  2798.                try {
  2799.                   var2 = this.fReader.lookingAtChar('%');
  2800.                   break;
  2801.                } catch (ArrayIndexOutOfBoundsException var7) {
  2802.                   this.popReader();
  2803.                   --this.fEntityStackDepth;
  2804.                   var1 = this.fReader.skippedSpace();
  2805.                   if (var1) {
  2806.                      this.fReader.skipPastSpaces();
  2807.                   }
  2808.                }
  2809.             }
  2810.  
  2811.             if (var2) {
  2812.                this.checkForPEReference(false);
  2813.                return true;
  2814.             } else {
  2815.                boolean var3 = false;
  2816.  
  2817.                while(true) {
  2818.                   this.expandPEReference();
  2819.  
  2820.                   while(true) {
  2821.                      try {
  2822.                         this.fReader.skipPastSpaces();
  2823.                         break;
  2824.                      } catch (ArrayIndexOutOfBoundsException var4) {
  2825.                         this.popReader();
  2826.                         --this.fEntityStackDepth;
  2827.                         this.fReader.skipPastSpaces();
  2828.                      }
  2829.                   }
  2830.  
  2831.                   var2 = this.checkSkippedChar('%', true);
  2832.                   if (!var2) {
  2833.                      return var3;
  2834.                   }
  2835.  
  2836.                   if (!var3) {
  2837.                      while(true) {
  2838.                         try {
  2839.                            var1 = this.fReader.skippedSpace();
  2840.                            break;
  2841.                         } catch (ArrayIndexOutOfBoundsException var5) {
  2842.                            this.popReader();
  2843.                            --this.fEntityStackDepth;
  2844.                         }
  2845.                      }
  2846.  
  2847.                      if (var1) {
  2848.                         this.checkForPEReference(false);
  2849.                         return true;
  2850.                      }
  2851.  
  2852.                      while(true) {
  2853.                         try {
  2854.                            var2 = this.fReader.skippedChar('%');
  2855.                            break;
  2856.                         } catch (ArrayIndexOutOfBoundsException var6) {
  2857.                            this.popReader();
  2858.                            --this.fEntityStackDepth;
  2859.                            var1 = this.fReader.skippedSpace();
  2860.                            if (var1) {
  2861.                               this.fReader.skipPastSpaces();
  2862.                            }
  2863.                         }
  2864.                      }
  2865.  
  2866.                      if (var2) {
  2867.                         var3 = true;
  2868.                      }
  2869.                   }
  2870.                }
  2871.             }
  2872.          }
  2873.       }
  2874.    }
  2875.  
  2876.    private void scanMarkupDecl(boolean var1) throws Exception {
  2877.       ++this.fScannerMarkupDepth;
  2878.  
  2879.       try {
  2880.          if (this.fReader.skippedChar('!')) {
  2881.             if (this.fReader.skippedChar('-')) {
  2882.                if (this.fReader.skippedChar('-')) {
  2883.                   this.scanComment(false);
  2884.                } else {
  2885.                   this.fErrorHandler.error(20);
  2886.                   this.fReader.skipPastChar('>');
  2887.                   --this.fScannerMarkupDepth;
  2888.                }
  2889.             } else if (this.fReader.skippedChar('[')) {
  2890.                if (this.fScannerState != 3) {
  2891.                   this.fErrorHandler.error(47);
  2892.                }
  2893.  
  2894.                this.checkForPEReference(false);
  2895.                if (this.fReader.skippedString(include_string)) {
  2896.                   this.checkForPEReference(false);
  2897.                   if (!this.checkSkippedChar('[', true)) {
  2898.                      this.fErrorHandler.error(23);
  2899.                      this.fReader.skipPastChar('>');
  2900.                      --this.fScannerMarkupDepth;
  2901.                   } else {
  2902.                      this.scanExtSubsetDecl(true);
  2903.                   }
  2904.                } else if (this.fReader.skippedString(ignore_string)) {
  2905.                   this.checkForPEReference(false);
  2906.                   if (!this.checkSkippedChar('[', true)) {
  2907.                      this.fErrorHandler.error(23);
  2908.                      this.fReader.skipPastChar('>');
  2909.                      --this.fScannerMarkupDepth;
  2910.                   } else {
  2911.                      this.scanIgnoreSectContents();
  2912.                   }
  2913.                } else {
  2914.                   this.fErrorHandler.error(23);
  2915.                   this.fReader.skipPastChar('>');
  2916.                   --this.fScannerMarkupDepth;
  2917.                }
  2918.             } else if (this.fReader.skippedString(element_string)) {
  2919.                this.scanElementDecl();
  2920.             } else if (this.fReader.skippedString(attlist_string)) {
  2921.                this.scanAttlistDecl();
  2922.             } else if (this.fReader.skippedString(entity_string)) {
  2923.                this.scanEntityDecl();
  2924.             } else if (this.fReader.skippedString(notation_string)) {
  2925.                this.scanNotationDecl();
  2926.             } else {
  2927.                this.fErrorHandler.error(46);
  2928.                this.fReader.skipPastChar('>');
  2929.                --this.fScannerMarkupDepth;
  2930.             }
  2931.          } else if (this.fReader.skippedChar('?')) {
  2932.             int var2 = this.fReader.scanName(' ', -1);
  2933.             if (var2 == -1) {
  2934.                this.fErrorHandler.error(102);
  2935.                this.fReader.skipPastChar('>');
  2936.                --this.fScannerMarkupDepth;
  2937.             } else if ("xml".equals(this.fStringPool.toString(var2))) {
  2938.                if (this.fReader.skippedSpace()) {
  2939.                   if (var1) {
  2940.                      this.scanTextDecl();
  2941.                   } else {
  2942.                      this.fErrorHandler.error(117);
  2943.                      this.fReader.skipPastChar('>');
  2944.                      --this.fScannerMarkupDepth;
  2945.                   }
  2946.                } else {
  2947.                   this.fErrorHandler.error(107);
  2948.                   this.fReader.skipPastChar('>');
  2949.                   --this.fScannerMarkupDepth;
  2950.                }
  2951.             } else {
  2952.                this.scanPI(var2, false);
  2953.             }
  2954.          } else {
  2955.             this.fErrorHandler.error(25);
  2956.             this.fReader.skipPastChar('>');
  2957.             --this.fScannerMarkupDepth;
  2958.          }
  2959.       } catch (ArrayIndexOutOfBoundsException var3) {
  2960.          if ((this.fEntityStackDepth == 0 ? 0 : this.fEntityNameStack[this.fEntityStackDepth - 1]) == 0) {
  2961.             --this.fScannerMarkupDepth;
  2962.          }
  2963.  
  2964.          throw var3;
  2965.       }
  2966.    }
  2967.  
  2968.    private void scanIgnoreSectContents() throws Exception {
  2969.       int var1 = 0;
  2970.  
  2971.       try {
  2972.          while(true) {
  2973.             while(!this.fReader.skippedChar('<')) {
  2974.                if (!this.fReader.skippedChar(']')) {
  2975.                   if (!this.fReader.skippedValidChar()) {
  2976.                      this.fReader.skipInvalidChar(85);
  2977.                   }
  2978.                } else if (this.fReader.skippedChar(']')) {
  2979.                   while(this.fReader.skippedChar(']')) {
  2980.                   }
  2981.  
  2982.                   if (this.fReader.skippedChar('>') && var1-- == 0) {
  2983.                      --this.fScannerMarkupDepth;
  2984.                      return;
  2985.                   }
  2986.                }
  2987.             }
  2988.  
  2989.             if (this.fReader.skippedChar('!') && this.fReader.skippedChar('[')) {
  2990.                ++var1;
  2991.             }
  2992.          }
  2993.       } catch (ArrayIndexOutOfBoundsException var3) {
  2994.          this.fErrorHandler.error(24);
  2995.          throw var3;
  2996.       }
  2997.    }
  2998.  
  2999.    private void scanElementDecl() throws Exception {
  3000.       if (this.fStop) {
  3001.          throw new StopException(this);
  3002.       } else if (!this.checkForPEReference(true)) {
  3003.          this.fErrorHandler.error(115);
  3004.          this.fReader.skipPastChar('>');
  3005.          --this.fScannerMarkupDepth;
  3006.       } else {
  3007.          int var1 = this.fReader.currentOffset();
  3008.  
  3009.          int var2;
  3010.          while(true) {
  3011.             try {
  3012.                var2 = this.fReader.skipPastName(' ') - var1;
  3013.                break;
  3014.             } catch (ArrayIndexOutOfBoundsException var5) {
  3015.                this.popReader();
  3016.                --this.fEntityStackDepth;
  3017.                var1 = this.fReader.skipPastSpaces();
  3018.             }
  3019.          }
  3020.  
  3021.          if (var2 == 0) {
  3022.             this.fErrorHandler.error(48);
  3023.             this.fReader.skipPastChar('>');
  3024.             --this.fScannerMarkupDepth;
  3025.          } else {
  3026.             if (this.fElementDecl == null) {
  3027.                this.fElementDecl = new ElementDecl();
  3028.             }
  3029.  
  3030.             this.fElementDecl.elementName = this.fReader.addSymbol(var1, var2);
  3031.             if (!this.checkForPEReference(true)) {
  3032.                this.fErrorHandler.error(115);
  3033.                this.fReader.skipPastChar('>');
  3034.                --this.fScannerMarkupDepth;
  3035.             } else if (!this.scanContentSpec()) {
  3036.                this.fReader.skipPastChar('>');
  3037.                --this.fScannerMarkupDepth;
  3038.             } else {
  3039.                this.checkForPEReference(false);
  3040.                if (!this.checkSkippedChar('>', true)) {
  3041.                   this.fErrorHandler.error(50);
  3042.                   this.fReader.skipPastChar('>');
  3043.                   --this.fScannerMarkupDepth;
  3044.                } else {
  3045.                   --this.fScannerMarkupDepth;
  3046.                   int var3 = this.fElementDeclPool.addElementDecl(this.fElementDecl);
  3047.                   if (this.fValidationHandler != null && var3 == -1) {
  3048.                      int var4 = this.fElementDecl.elementName;
  3049.                      this.fErrorHandler.error1(51, var4);
  3050.                   } else {
  3051.                      if (this.fDocumentTypeHandler != null) {
  3052.                         this.fDocumentTypeHandler.elementDecl(var3);
  3053.                      }
  3054.  
  3055.                   }
  3056.                }
  3057.             }
  3058.          }
  3059.       }
  3060.    }
  3061.  
  3062.    private boolean scanContentSpec() throws Exception {
  3063.       if (this.fReader.skippedString(empty_string)) {
  3064.          this.fElementDecl.contentSpecType = 1;
  3065.          this.fElementDecl.contentSpec = -1;
  3066.          return true;
  3067.       } else if (this.fReader.skippedString(any_string)) {
  3068.          this.fElementDecl.contentSpecType = 2;
  3069.          this.fElementDecl.contentSpec = -1;
  3070.          return true;
  3071.       } else if (!this.fReader.skippedChar('(')) {
  3072.          this.fErrorHandler.error(49);
  3073.          return false;
  3074.       } else {
  3075.          int var1 = this.fScannerParenDepth++;
  3076.          this.checkForPEReference(false);
  3077.          boolean var2 = false;
  3078.  
  3079.          while(true) {
  3080.             try {
  3081.                var2 = this.fReader.skippedString(pcdata_string);
  3082.                break;
  3083.             } catch (ArrayIndexOutOfBoundsException var4) {
  3084.                this.popReader();
  3085.                --this.fEntityStackDepth;
  3086.                this.fReader.skipPastSpaces();
  3087.             }
  3088.          }
  3089.  
  3090.          if (this.fContentSpecNode == null) {
  3091.             this.fContentSpecNode = new ContentSpecNode();
  3092.          }
  3093.  
  3094.          this.fContentSpecNode.otherValue = -1;
  3095.          boolean var3 = var2 ? this.scanMixed() : this.scanChildren();
  3096.          if (!var3) {
  3097.             this.fScannerParenDepth = var1;
  3098.          }
  3099.  
  3100.          return var3;
  3101.       }
  3102.    }
  3103.  
  3104.    private boolean scanMixed() throws Exception {
  3105.       int var1 = -1;
  3106.       int var2 = -1;
  3107.       boolean var3 = false;
  3108.  
  3109.       while(true) {
  3110.          this.fContentSpecNode.type = 0;
  3111.          this.fContentSpecNode.value = var1;
  3112.          int var4 = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
  3113.          this.checkForPEReference(false);
  3114.          if (!this.checkSkippedChar('|', true)) {
  3115.             if (!this.checkSkippedChar(')', true)) {
  3116.                this.fErrorHandler.error(31);
  3117.                return false;
  3118.             }
  3119.  
  3120.             --this.fScannerParenDepth;
  3121.             if (var2 != -1) {
  3122.                this.fContentSpecNode.type = 4;
  3123.                this.fContentSpecNode.value = var2;
  3124.                this.fContentSpecNode.otherValue = var4;
  3125.                var4 = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
  3126.                this.fContentSpecNode.otherValue = -1;
  3127.             }
  3128.  
  3129.             if (this.checkSkippedChar('*', false)) {
  3130.                this.fContentSpecNode.type = 2;
  3131.                this.fContentSpecNode.value = var4;
  3132.                var4 = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
  3133.             } else if (var3) {
  3134.                int var8 = this.fStringPool.addString(this.fElementDeclPool.getContentSpecNodeAsString(var4));
  3135.                this.fErrorHandler.error1(37, var8);
  3136.                return false;
  3137.             }
  3138.  
  3139.             this.fElementDecl.contentSpecType = 3;
  3140.             this.fElementDecl.contentSpec = var4;
  3141.             return true;
  3142.          }
  3143.  
  3144.          if (var2 != -1) {
  3145.             this.fContentSpecNode.type = 4;
  3146.             this.fContentSpecNode.value = var2;
  3147.             this.fContentSpecNode.otherValue = var4;
  3148.             var4 = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
  3149.             this.fContentSpecNode.otherValue = -1;
  3150.          }
  3151.  
  3152.          var2 = var4;
  3153.          var3 = true;
  3154.          this.checkForPEReference(false);
  3155.          int var5 = this.fReader.currentOffset();
  3156.  
  3157.          while(true) {
  3158.             int var6;
  3159.             try {
  3160.                var6 = this.fReader.skipPastName(')') - var5;
  3161.             } catch (ArrayIndexOutOfBoundsException var7) {
  3162.                this.popReader();
  3163.                --this.fEntityStackDepth;
  3164.                var5 = this.fReader.skipPastSpaces();
  3165.                continue;
  3166.             }
  3167.  
  3168.             if (var6 == 0) {
  3169.                this.fErrorHandler.error(33);
  3170.                return false;
  3171.             }
  3172.  
  3173.             var1 = this.fReader.addSymbol(var5, var6);
  3174.             break;
  3175.          }
  3176.       }
  3177.    }
  3178.  
  3179.    private boolean scanChildren() throws Exception {
  3180.       int var1 = 1;
  3181.       this.initializeContentModelStack(var1);
  3182.  
  3183.       while(true) {
  3184.          label92:
  3185.          for(; !this.checkSkippedChar('(', true); this.checkForPEReference(false)) {
  3186.             int var2 = this.fReader.currentOffset();
  3187.  
  3188.             int var3;
  3189.             while(true) {
  3190.                try {
  3191.                   var3 = this.fReader.skipPastName(')') - var2;
  3192.                   break;
  3193.                } catch (ArrayIndexOutOfBoundsException var7) {
  3194.                   this.popReader();
  3195.                   --this.fEntityStackDepth;
  3196.                   var2 = this.fReader.skipPastSpaces();
  3197.                }
  3198.             }
  3199.  
  3200.             if (var3 == 0) {
  3201.                if (this.fScannerState != 3 && this.fReader.lookingAtChar('%')) {
  3202.                   this.fErrorHandler.error(96);
  3203.                } else {
  3204.                   this.fErrorHandler.error(33);
  3205.                }
  3206.  
  3207.                return false;
  3208.             }
  3209.  
  3210.             int var4 = this.fReader.addSymbol(var2, var3);
  3211.             this.fContentSpecNode.type = 0;
  3212.             this.fContentSpecNode.value = var4;
  3213.             this.nodeIndexStack[var1] = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
  3214.             if (this.fReader.skippedChar('?')) {
  3215.                this.fContentSpecNode.type = 1;
  3216.                this.fContentSpecNode.value = this.nodeIndexStack[var1];
  3217.                this.nodeIndexStack[var1] = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
  3218.             } else if (this.fReader.skippedChar('*')) {
  3219.                this.fContentSpecNode.type = 2;
  3220.                this.fContentSpecNode.value = this.nodeIndexStack[var1];
  3221.                this.nodeIndexStack[var1] = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
  3222.             } else if (this.fReader.skippedChar('+')) {
  3223.                this.fContentSpecNode.type = 3;
  3224.                this.fContentSpecNode.value = this.nodeIndexStack[var1];
  3225.                this.nodeIndexStack[var1] = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
  3226.             }
  3227.  
  3228.             do {
  3229.                this.checkForPEReference(false);
  3230.                if (this.checkSkippedChar('|', true)) {
  3231.                   if (this.prevNodeIndexStack[var1] != -1) {
  3232.                      this.fContentSpecNode.type = this.opStack[var1];
  3233.                      this.fContentSpecNode.value = this.prevNodeIndexStack[var1];
  3234.                      this.fContentSpecNode.otherValue = this.nodeIndexStack[var1];
  3235.                      this.nodeIndexStack[var1] = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
  3236.                      this.fContentSpecNode.otherValue = -1;
  3237.                   }
  3238.  
  3239.                   this.prevNodeIndexStack[var1] = this.nodeIndexStack[var1];
  3240.                   if (this.opStack[var1] == 5) {
  3241.                      int var9 = this.fStringPool.addString("|");
  3242.                      int var10 = this.fStringPool.addString(",");
  3243.                      this.fErrorHandler.error2(34, var9, var10);
  3244.                   }
  3245.  
  3246.                   this.opStack[var1] = 4;
  3247.                   continue label92;
  3248.                }
  3249.  
  3250.                if (this.checkSkippedChar(',', true)) {
  3251.                   if (this.prevNodeIndexStack[var1] != -1) {
  3252.                      this.fContentSpecNode.type = this.opStack[var1];
  3253.                      this.fContentSpecNode.value = this.prevNodeIndexStack[var1];
  3254.                      this.fContentSpecNode.otherValue = this.nodeIndexStack[var1];
  3255.                      this.nodeIndexStack[var1] = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
  3256.                      this.fContentSpecNode.otherValue = -1;
  3257.                   }
  3258.  
  3259.                   this.prevNodeIndexStack[var1] = this.nodeIndexStack[var1];
  3260.                   if (this.opStack[var1] == 4) {
  3261.                      int var8 = this.fStringPool.addString(",");
  3262.                      int var6 = this.fStringPool.addString("|");
  3263.                      this.fErrorHandler.error2(34, var8, var6);
  3264.                   }
  3265.  
  3266.                   this.opStack[var1] = 5;
  3267.                   continue label92;
  3268.                }
  3269.  
  3270.                if (!this.checkSkippedChar(')', true)) {
  3271.                   this.fErrorHandler.error(31);
  3272.                }
  3273.  
  3274.                --this.fScannerParenDepth;
  3275.                if (this.prevNodeIndexStack[var1] != -1) {
  3276.                   this.fContentSpecNode.type = this.opStack[var1];
  3277.                   this.fContentSpecNode.value = this.prevNodeIndexStack[var1];
  3278.                   this.fContentSpecNode.otherValue = this.nodeIndexStack[var1];
  3279.                   this.nodeIndexStack[var1] = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
  3280.                   this.fContentSpecNode.otherValue = -1;
  3281.                }
  3282.  
  3283.                int var5 = this.nodeIndexStack[var1--];
  3284.                this.nodeIndexStack[var1] = var5;
  3285.                if (this.fReader.skippedChar('?')) {
  3286.                   this.fContentSpecNode.type = 1;
  3287.                   this.fContentSpecNode.value = this.nodeIndexStack[var1];
  3288.                   this.nodeIndexStack[var1] = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
  3289.                } else if (this.fReader.skippedChar('*')) {
  3290.                   this.fContentSpecNode.type = 2;
  3291.                   this.fContentSpecNode.value = this.nodeIndexStack[var1];
  3292.                   this.nodeIndexStack[var1] = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
  3293.                } else if (this.fReader.skippedChar('+')) {
  3294.                   this.fContentSpecNode.type = 3;
  3295.                   this.fContentSpecNode.value = this.nodeIndexStack[var1];
  3296.                   this.nodeIndexStack[var1] = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
  3297.                }
  3298.             } while(var1 != 0);
  3299.  
  3300.             this.fElementDecl.contentSpecType = 4;
  3301.             this.fElementDecl.contentSpec = this.nodeIndexStack[0];
  3302.             return true;
  3303.          }
  3304.  
  3305.          ++this.fScannerParenDepth;
  3306.          this.checkForPEReference(false);
  3307.          ++var1;
  3308.          this.initializeContentModelStack(var1);
  3309.       }
  3310.    }
  3311.  
  3312.    private void scanAttlistDecl() throws Exception {
  3313.       if (!this.checkForPEReference(true)) {
  3314.          this.fErrorHandler.error(115);
  3315.          this.fReader.skipPastChar('>');
  3316.          --this.fScannerMarkupDepth;
  3317.       } else {
  3318.          int var1 = this.fReader.currentOffset();
  3319.  
  3320.          int var2;
  3321.          while(true) {
  3322.             try {
  3323.                var2 = this.fReader.skipPastName(' ') - var1;
  3324.                break;
  3325.             } catch (ArrayIndexOutOfBoundsException var8) {
  3326.                this.popReader();
  3327.                --this.fEntityStackDepth;
  3328.                var1 = this.fReader.skipPastSpaces();
  3329.             }
  3330.          }
  3331.  
  3332.          if (var2 == 0) {
  3333.             this.fErrorHandler.error(11);
  3334.             this.fReader.skipPastChar('>');
  3335.             --this.fScannerMarkupDepth;
  3336.          } else {
  3337.             int var3 = this.fReader.addSymbol(var1, var2);
  3338.             int var4 = this.fElementDeclPool.addElement(var3);
  3339.             if (this.fAttDef == null) {
  3340.                this.fAttDef = new AttDef();
  3341.             }
  3342.  
  3343.             while(true) {
  3344.                boolean var5 = this.checkForPEReference(true);
  3345.  
  3346.                while(true) {
  3347.                   try {
  3348.                      if (this.fReader.skippedChar('>')) {
  3349.                         --this.fScannerMarkupDepth;
  3350.                         return;
  3351.                      }
  3352.                   } catch (ArrayIndexOutOfBoundsException var7) {
  3353.                      this.popReader();
  3354.                      --this.fEntityStackDepth;
  3355.                      if (var5) {
  3356.                         this.fReader.skippedSpace();
  3357.                      } else {
  3358.                         var5 = this.fReader.skippedSpace();
  3359.                         if (var5) {
  3360.                            this.fReader.skipPastSpaces();
  3361.                         }
  3362.                      }
  3363.                      continue;
  3364.                   }
  3365.  
  3366.                   if (!var5) {
  3367.                      this.fErrorHandler.error(115);
  3368.                   }
  3369.  
  3370.                   if (!this.scanAttDef()) {
  3371.                      this.fReader.skipPastChar('>');
  3372.                      --this.fScannerMarkupDepth;
  3373.                      return;
  3374.                   }
  3375.  
  3376.                   int var6 = this.fElementDeclPool.addAttDef(var4, this.fAttDef);
  3377.                   if (var6 != -1 && this.fDocumentTypeHandler != null) {
  3378.                      this.fDocumentTypeHandler.attlistDecl(var4, var6);
  3379.                   }
  3380.                   break;
  3381.                }
  3382.             }
  3383.          }
  3384.       }
  3385.    }
  3386.  
  3387.    private boolean scanAttDef() throws Exception {
  3388.       int var1 = this.fReader.currentOffset();
  3389.       int var2 = 0;
  3390.  
  3391.       while(true) {
  3392.          try {
  3393.             var2 = this.fReader.skipPastName(' ') - var1;
  3394.             break;
  3395.          } catch (ArrayIndexOutOfBoundsException var3) {
  3396.             this.popReader();
  3397.             --this.fEntityStackDepth;
  3398.             var1 = this.fReader.skipPastSpaces();
  3399.          }
  3400.       }
  3401.  
  3402.       if (var2 == 0) {
  3403.          this.fErrorHandler.error(2);
  3404.          return false;
  3405.       } else {
  3406.          this.fAttDef.attName = this.fReader.addSymbol(var1, var2);
  3407.          if (!this.checkForPEReference(true)) {
  3408.             this.fErrorHandler.error(115);
  3409.             return false;
  3410.          } else if (!this.scanAttType()) {
  3411.             return false;
  3412.          } else if (!this.checkForPEReference(true)) {
  3413.             this.fErrorHandler.error(115);
  3414.             return false;
  3415.          } else {
  3416.             return this.scanDefaultDecl();
  3417.          }
  3418.       }
  3419.    }
  3420.  
  3421.    private boolean scanAttType() throws Exception {
  3422.       this.fAttDef.enumeration = -1;
  3423.  
  3424.       while(true) {
  3425.          try {
  3426.             if (this.fReader.skippedString(cdata_string)) {
  3427.                this.fAttDef.attType = 0;
  3428.             } else if (this.fReader.skippedString(id_string)) {
  3429.                if (!this.fReader.skippedString(ref_string)) {
  3430.                   this.fAttDef.attType = 1;
  3431.                } else if (!this.fReader.skippedChar('S')) {
  3432.                   this.fAttDef.attType = 2;
  3433.                } else {
  3434.                   this.fAttDef.attType = 3;
  3435.                }
  3436.             } else if (this.fReader.skippedString(entit_string)) {
  3437.                if (this.fReader.skippedChar('Y')) {
  3438.                   this.fAttDef.attType = 4;
  3439.                } else if (this.fReader.skippedString(ies_string)) {
  3440.                   this.fAttDef.attType = 5;
  3441.                } else {
  3442.                   this.fErrorHandler.error(4);
  3443.                   this.fReader.skipPastNmtoken(' ');
  3444.                }
  3445.             } else if (this.fReader.skippedString(nmtoken_string)) {
  3446.                if (this.fReader.skippedChar('S')) {
  3447.                   this.fAttDef.attType = 7;
  3448.                } else {
  3449.                   this.fAttDef.attType = 6;
  3450.                }
  3451.             } else if (this.fReader.skippedString(notation_string)) {
  3452.                this.fAttDef.attType = 8;
  3453.                if (!this.scanEnumeration(true)) {
  3454.                   return false;
  3455.                }
  3456.             } else {
  3457.                if (!this.fReader.skippedChar('(')) {
  3458.                   this.fErrorHandler.error(4);
  3459.                   return false;
  3460.                }
  3461.  
  3462.                ++this.fScannerParenDepth;
  3463.                this.fAttDef.attType = 9;
  3464.                if (!this.scanEnumeration(false)) {
  3465.                   return false;
  3466.                }
  3467.             }
  3468.  
  3469.             return true;
  3470.          } catch (ArrayIndexOutOfBoundsException var1) {
  3471.             this.popReader();
  3472.             --this.fEntityStackDepth;
  3473.             this.fReader.skipPastSpaces();
  3474.          }
  3475.       }
  3476.    }
  3477.  
  3478.    private boolean scanEnumeration(boolean var1) throws Exception {
  3479.       if (var1) {
  3480.          if (!this.checkForPEReference(true)) {
  3481.             this.fErrorHandler.error(115);
  3482.             return false;
  3483.          }
  3484.  
  3485.          while(true) {
  3486.             try {
  3487.                if (!this.fReader.skippedChar('(')) {
  3488.                   this.fErrorHandler.error(71);
  3489.                   return false;
  3490.                }
  3491.             } catch (ArrayIndexOutOfBoundsException var9) {
  3492.                this.popReader();
  3493.                --this.fEntityStackDepth;
  3494.                this.fReader.skipPastSpaces();
  3495.                continue;
  3496.             }
  3497.  
  3498.             ++this.fScannerParenDepth;
  3499.             break;
  3500.          }
  3501.       }
  3502.  
  3503.       this.fAttDef.enumeration = this.fStringPool.startStringList();
  3504.       boolean var2 = false;
  3505.  
  3506.       do {
  3507.          this.checkForPEReference(false);
  3508.          int var3 = this.fReader.currentOffset();
  3509.  
  3510.          int var4;
  3511.          while(true) {
  3512.             try {
  3513.                if (var1) {
  3514.                   var4 = this.fReader.skipPastName(')') - var3;
  3515.                } else {
  3516.                   var4 = this.fReader.skipPastNmtoken(')') - var3;
  3517.                }
  3518.                break;
  3519.             } catch (ArrayIndexOutOfBoundsException var6) {
  3520.                this.popReader();
  3521.                --this.fEntityStackDepth;
  3522.                var3 = this.fReader.skipPastSpaces();
  3523.             }
  3524.          }
  3525.  
  3526.          if (var4 == 0) {
  3527.             int var11 = var1 ? 72 : 73;
  3528.             this.fErrorHandler.error(var11);
  3529.             this.fStringPool.finishStringList(this.fAttDef.enumeration);
  3530.             return false;
  3531.          }
  3532.  
  3533.          int var5 = this.fReader.addSymbol(var3, var4);
  3534.          this.checkForPEReference(false);
  3535.  
  3536.          while(true) {
  3537.             try {
  3538.                var2 = this.fReader.skippedChar('|');
  3539.                break;
  3540.             } catch (ArrayIndexOutOfBoundsException var7) {
  3541.                this.popReader();
  3542.                --this.fEntityStackDepth;
  3543.                this.fReader.skipPastSpaces();
  3544.             }
  3545.          }
  3546.  
  3547.          if (!var2) {
  3548.             while(true) {
  3549.                try {
  3550.                   if (!this.fReader.skippedChar(')')) {
  3551.                      this.fErrorHandler.error(74);
  3552.                      this.fStringPool.finishStringList(this.fAttDef.enumeration);
  3553.                      return false;
  3554.                   }
  3555.                } catch (ArrayIndexOutOfBoundsException var8) {
  3556.                   this.popReader();
  3557.                   --this.fEntityStackDepth;
  3558.                   this.fReader.skipPastSpaces();
  3559.                   continue;
  3560.                }
  3561.  
  3562.                --this.fScannerParenDepth;
  3563.                break;
  3564.             }
  3565.          }
  3566.  
  3567.          this.fStringPool.addStringToList(this.fAttDef.enumeration, var5);
  3568.       } while(var2);
  3569.  
  3570.       this.fStringPool.finishStringList(this.fAttDef.enumeration);
  3571.       return true;
  3572.    }
  3573.  
  3574.    private boolean scanDefaultDecl() throws Exception {
  3575.       if (this.fReader.skippedString(required_string)) {
  3576.          this.fAttDef.attDefaultType = 2;
  3577.          this.fAttDef.attValue = -1;
  3578.          return true;
  3579.       } else if (this.fReader.skippedString(implied_string)) {
  3580.          this.fAttDef.attDefaultType = 3;
  3581.          this.fAttDef.attValue = -1;
  3582.          return true;
  3583.       } else {
  3584.          if (this.fReader.skippedString(fixed_string)) {
  3585.             this.fAttDef.attDefaultType = 4;
  3586.             if (!this.fReader.skippedSpace()) {
  3587.                this.fErrorHandler.error(115);
  3588.                return false;
  3589.             }
  3590.  
  3591.             this.fReader.skipPastSpaces();
  3592.          } else {
  3593.             this.fAttDef.attDefaultType = 1;
  3594.          }
  3595.  
  3596.          if (!this.scanAttValue(-1, -1, this.fAttDef.attType, true, this.fAttDef.attDefaultType == 4, true)) {
  3597.             this.fErrorHandler.error(173);
  3598.             return false;
  3599.          } else {
  3600.             this.fAttDef.attValue = this.fAttValueIndex;
  3601.             return true;
  3602.          }
  3603.       }
  3604.    }
  3605.  
  3606.    private void scanNotationDecl() throws Exception {
  3607.       if (!this.checkForPEReference(true)) {
  3608.          this.fErrorHandler.error(115);
  3609.          this.fReader.skipPastChar('>');
  3610.          --this.fScannerMarkupDepth;
  3611.       } else {
  3612.          int var1 = this.fReader.currentOffset();
  3613.  
  3614.          int var2;
  3615.          while(true) {
  3616.             try {
  3617.                var2 = this.fReader.skipPastName(' ') - var1;
  3618.                break;
  3619.             } catch (ArrayIndexOutOfBoundsException var5) {
  3620.                this.popReader();
  3621.                --this.fEntityStackDepth;
  3622.                var1 = this.fReader.skipPastSpaces();
  3623.             }
  3624.          }
  3625.  
  3626.          if (var2 == 0) {
  3627.             this.fErrorHandler.error(91);
  3628.             this.fReader.skipPastChar('>');
  3629.             --this.fScannerMarkupDepth;
  3630.          } else {
  3631.             if (this.fNotationDecl == null) {
  3632.                this.fNotationDecl = new NotationDecl();
  3633.             }
  3634.  
  3635.             this.fNotationDecl.notationName = this.fReader.addSymbol(var1, var2);
  3636.             if (!this.checkForPEReference(true)) {
  3637.                this.fErrorHandler.error(115);
  3638.                this.fReader.skipPastChar('>');
  3639.                --this.fScannerMarkupDepth;
  3640.             } else if (!this.scanExternalIDorPublicID(true, true)) {
  3641.                this.fReader.skipPastChar('>');
  3642.                --this.fScannerMarkupDepth;
  3643.             } else {
  3644.                this.fNotationDecl.publicId = this.fPubidLiteral;
  3645.                this.fNotationDecl.systemId = this.fSystemLiteral;
  3646.                this.checkForPEReference(false);
  3647.  
  3648.                while(true) {
  3649.                   try {
  3650.                      if (!this.fReader.skippedChar('>')) {
  3651.                         this.fErrorHandler.error(163);
  3652.                         this.fReader.skipPastChar('>');
  3653.                         --this.fScannerMarkupDepth;
  3654.                         return;
  3655.                      }
  3656.  
  3657.                      --this.fScannerMarkupDepth;
  3658.                   } catch (ArrayIndexOutOfBoundsException var4) {
  3659.                      this.popReader();
  3660.                      --this.fEntityStackDepth;
  3661.                      this.fReader.skipPastSpaces();
  3662.                      continue;
  3663.                   }
  3664.  
  3665.                   int var3 = this.fEntityPool.addNotationDecl(this.fNotationDecl);
  3666.                   if (var3 != -1 && this.fDocumentTypeHandler != null) {
  3667.                      this.fDocumentTypeHandler.notationDecl(var3);
  3668.                   }
  3669.  
  3670.                   return;
  3671.                }
  3672.             }
  3673.          }
  3674.       }
  3675.    }
  3676.  
  3677.    private void scanEntityDecl() throws Exception {
  3678.       boolean var1 = this.checkForPEDecl();
  3679.       int var2 = this.fReader.currentOffset();
  3680.  
  3681.       int var3;
  3682.       while(true) {
  3683.          try {
  3684.             var3 = this.fReader.skipPastName(' ') - var2;
  3685.             break;
  3686.          } catch (ArrayIndexOutOfBoundsException var8) {
  3687.             this.popReader();
  3688.             --this.fEntityStackDepth;
  3689.             var2 = this.fReader.skipPastSpaces();
  3690.          }
  3691.       }
  3692.  
  3693.       if (var3 == 0) {
  3694.          this.fErrorHandler.error(61);
  3695.          this.fReader.skipPastChar('>');
  3696.          --this.fScannerMarkupDepth;
  3697.       } else {
  3698.          int var4 = this.fReader.addSymbol(var2, var3);
  3699.          boolean var5 = this.pushEntity((byte)(var1 ? 1 : 0), var4);
  3700.          if (!var5) {
  3701.             this.fReader.skipPastChar('>');
  3702.             --this.fScannerMarkupDepth;
  3703.          } else {
  3704.             if (this.fEntityDecl == null) {
  3705.                this.fEntityDecl = new EntityDecl();
  3706.             }
  3707.  
  3708.             this.fEntityDecl.entityName = var4;
  3709.             this.fEntityDecl.entityValue = -1;
  3710.             this.fEntityDecl.publicId = -1;
  3711.             this.fEntityDecl.systemId = -1;
  3712.             this.fEntityDecl.notationName = -1;
  3713.             if (!this.checkForPEReference(true)) {
  3714.                this.fErrorHandler.error(115);
  3715.                this.fReader.skipPastChar('>');
  3716.                --this.fScannerMarkupDepth;
  3717.                --this.fEntityStackDepth;
  3718.             } else if (!(var1 ? this.scanPEDef() : this.scanEntityDef())) {
  3719.                this.fReader.skipPastChar('>');
  3720.                --this.fScannerMarkupDepth;
  3721.                --this.fEntityStackDepth;
  3722.             } else {
  3723.                this.checkForPEReference(false);
  3724.  
  3725.                while(true) {
  3726.                   try {
  3727.                      if (!this.fReader.skippedChar('>')) {
  3728.                         this.fErrorHandler.error(64);
  3729.                         this.fReader.skipPastChar('>');
  3730.                         --this.fScannerMarkupDepth;
  3731.                         --this.fEntityStackDepth;
  3732.                         return;
  3733.                      }
  3734.  
  3735.                      --this.fScannerMarkupDepth;
  3736.                   } catch (ArrayIndexOutOfBoundsException var7) {
  3737.                      this.popReader();
  3738.                      --this.fEntityStackDepth;
  3739.                      this.fReader.skipPastSpaces();
  3740.                      continue;
  3741.                   }
  3742.  
  3743.                   --this.fEntityStackDepth;
  3744.                   if (var1) {
  3745.                      if (this.fParameterEntityPool == null) {
  3746.                         this.fParameterEntityPool = new DefaultEntityPool(this.fParserState, false);
  3747.                         this.fParserState.setParameterEntityPool(this.fParameterEntityPool);
  3748.                      }
  3749.  
  3750.                      int var9 = this.fParameterEntityPool.addEntityDecl(this.fEntityDecl);
  3751.                      this.fDocumentTypeHandler.parameterEntityDecl(var9);
  3752.                      return;
  3753.                   }
  3754.  
  3755.                   int var6 = this.fEntityPool.addEntityDecl(this.fEntityDecl);
  3756.                   if (this.fDocumentTypeHandler != null) {
  3757.                      if (this.fEntityDecl.entityValue == -1) {
  3758.                         if (this.fEntityDecl.notationName == -1) {
  3759.                            this.fDocumentTypeHandler.externalEntityDecl(var6);
  3760.                            return;
  3761.                         }
  3762.  
  3763.                         this.fDocumentTypeHandler.unparsedEntityDecl(var6);
  3764.                         return;
  3765.                      }
  3766.  
  3767.                      this.fDocumentTypeHandler.internalEntityDecl(var6);
  3768.                   }
  3769.  
  3770.                   return;
  3771.                }
  3772.             }
  3773.          }
  3774.       }
  3775.    }
  3776.  
  3777.    private boolean scanEntityDef() throws Exception {
  3778.       boolean var1;
  3779.       if (!(var1 = this.fReader.skippedChar('\'')) && !this.fReader.skippedChar('"')) {
  3780.          if (!this.scanExternalIDorPublicID(true, false)) {
  3781.             return false;
  3782.          } else {
  3783.             this.fEntityDecl.publicId = this.fPubidLiteral;
  3784.             this.fEntityDecl.systemId = this.fSystemLiteral;
  3785.             if (!this.fReader.skippedSpace()) {
  3786.                return true;
  3787.             } else {
  3788.                this.fReader.skipPastSpaces();
  3789.                if (this.fReader.skippedString(ndata_string)) {
  3790.                   if (!this.fReader.skippedSpace()) {
  3791.                      this.fErrorHandler.error(115);
  3792.                      return false;
  3793.                   }
  3794.  
  3795.                   int var2 = this.fReader.skipPastSpaces();
  3796.                   int var3 = this.fReader.skipPastName('>') - var2;
  3797.                   if (var3 == 0) {
  3798.                      this.fErrorHandler.error(65);
  3799.                      return false;
  3800.                   }
  3801.  
  3802.                   this.fEntityDecl.notationName = this.fReader.addSymbol(var2, var3);
  3803.                }
  3804.  
  3805.                return true;
  3806.             }
  3807.          }
  3808.       } else {
  3809.          return this.scanEntityValue(var1);
  3810.       }
  3811.    }
  3812.  
  3813.    private boolean scanPEDef() throws Exception {
  3814.       boolean var1;
  3815.       if (!(var1 = this.fReader.skippedChar('\'')) && !this.fReader.skippedChar('"')) {
  3816.          if (!this.scanExternalIDorPublicID(true, false)) {
  3817.             return false;
  3818.          } else {
  3819.             this.fEntityDecl.publicId = this.fPubidLiteral;
  3820.             this.fEntityDecl.systemId = this.fSystemLiteral;
  3821.             return true;
  3822.          }
  3823.       } else {
  3824.          return this.scanEntityValue(var1);
  3825.       }
  3826.    }
  3827.  
  3828.    private boolean scanEntityValue(boolean var1) throws Exception {
  3829.       int var2 = this.fReader.currentOffset();
  3830.       int var3 = var1 ? 39 : 34;
  3831.       int var4 = var2;
  3832.       int var5 = this.fLiteralData.length();
  3833.  
  3834.       while(!this.fReader.skippedChar((char)var3)) {
  3835.          if (this.fReader.skippedChar('&')) {
  3836.             if (var2 - var4 > 0) {
  3837.                this.fReader.append(this.fLiteralData, var4, var2 - var4);
  3838.             }
  3839.  
  3840.             var2 = this.referenceInEntityValue(var2, true);
  3841.             var4 = var2;
  3842.          } else if (this.fReader.skippedChar('%')) {
  3843.             if (var2 - var4 > 0) {
  3844.                this.fReader.append(this.fLiteralData, var4, var2 - var4);
  3845.             }
  3846.  
  3847.             if (!this.copyPEReference()) {
  3848.                this.fReader.skipToChar((char)var3);
  3849.                return false;
  3850.             }
  3851.  
  3852.             var2 = this.fReader.currentOffset();
  3853.             var4 = var2;
  3854.          } else {
  3855.             if (!this.fReader.skippedValidChar()) {
  3856.                this.fReader.skipInvalidChar(63);
  3857.                this.fReader.skipToChar((char)var3);
  3858.                return false;
  3859.             }
  3860.  
  3861.             var2 = this.fReader.currentOffset();
  3862.          }
  3863.       }
  3864.  
  3865.       if (var2 - var4 > 0) {
  3866.          this.fReader.append(this.fLiteralData, var4, var2 - var4);
  3867.       }
  3868.  
  3869.       int var6 = this.fLiteralData.length() - var5;
  3870.       this.fEntityDecl.entityValue = this.fLiteralData.addString(var5, var6);
  3871.       return true;
  3872.    }
  3873.  
  3874.    private void growReaderStack() {
  3875.       XMLReader[] var1 = new XMLReader[this.fReaderStackDepth * 2];
  3876.       System.arraycopy(this.fReaderStack, 0, var1, 0, this.fReaderStackDepth);
  3877.       this.fReaderStack = var1;
  3878.       InputSource[] var2 = new InputSource[this.fReaderStackDepth * 2];
  3879.       System.arraycopy(this.fReaderSource, 0, var2, 0, this.fReaderStackDepth);
  3880.       this.fReaderSource = var2;
  3881.       int[] var3 = new int[this.fReaderStackDepth * 2];
  3882.       System.arraycopy(this.fReaderMarkupDepth, 0, var3, 0, this.fReaderStackDepth);
  3883.       this.fReaderMarkupDepth = var3;
  3884.       var3 = new int[this.fReaderStackDepth * 2];
  3885.       System.arraycopy(this.fReaderParenDepth, 0, var3, 0, this.fReaderStackDepth);
  3886.       this.fReaderParenDepth = var3;
  3887.    }
  3888.  
  3889.    private int pushReader(XMLReader var1, InputSource var2) {
  3890.       if (this.fReaderStackDepth == this.fReaderStack.length) {
  3891.          this.growReaderStack();
  3892.       }
  3893.  
  3894.       this.fReaderStack[this.fReaderStackDepth] = this.fReader;
  3895.       this.fReaderSource[this.fReaderStackDepth] = var2;
  3896.       this.fReaderMarkupDepth[this.fReaderStackDepth] = this.fScannerMarkupDepth;
  3897.       this.fReaderParenDepth[this.fReaderStackDepth] = this.fScannerParenDepth;
  3898.       this.fReader = var1;
  3899.       return ++this.fReaderStackDepth;
  3900.    }
  3901.  
  3902.    private void popReader() throws Exception {
  3903.       if (this.fReaderStackDepth == this.fActiveReaderLimit) {
  3904.          throw new ArrayIndexOutOfBoundsException();
  3905.       } else {
  3906.          --this.fReaderStackDepth;
  3907.          int var1 = this.fEntityStackDepth == 0 ? 0 : this.fEntityNameStack[this.fEntityStackDepth - 1];
  3908.          if (var1 != 0) {
  3909.             if (this.fValidationHandler != null && this.fScannerParenDepth != this.fReaderParenDepth[this.fReaderStackDepth]) {
  3910.                this.fErrorHandler.error1(99, var1);
  3911.             }
  3912.  
  3913.             if (this.fScannerMarkupDepth != this.fReaderMarkupDepth[this.fReaderStackDepth]) {
  3914.                if ((this.fEntityStackDepth == 0 ? 0 : this.fEntityTypeStack[this.fEntityStackDepth - 1]) == 0) {
  3915.                   this.fErrorHandler.error(138);
  3916.                } else {
  3917.                   this.fErrorHandler.error1(101, var1);
  3918.                }
  3919.             }
  3920.          }
  3921.  
  3922.          this.fReader = this.fReaderStack[this.fReaderStackDepth];
  3923.          InputSource var2 = this.fReaderSource[this.fReaderStackDepth];
  3924.          if (var2 != null) {
  3925.             this.fEntityHandler.endInputSource(var2);
  3926.             this.fReaderSource[this.fReaderStackDepth] = null;
  3927.          }
  3928.  
  3929.       }
  3930.    }
  3931.  
  3932.    private int setActiveReaderLimit(int var1) {
  3933.       int var2 = this.fActiveReaderLimit;
  3934.       this.fActiveReaderLimit = var1;
  3935.       return var2;
  3936.    }
  3937.  
  3938.    private int increaseParenDepth() {
  3939.       return this.fScannerParenDepth++;
  3940.    }
  3941.  
  3942.    private int decreaseParenDepth() {
  3943.       return this.fScannerParenDepth--;
  3944.    }
  3945.  
  3946.    private int increaseMarkupDepth() {
  3947.       return this.fScannerMarkupDepth++;
  3948.    }
  3949.  
  3950.    private int decreaseMarkupDepth() {
  3951.       return this.fScannerMarkupDepth--;
  3952.    }
  3953.  
  3954.    private void pushElementName(int var1) {
  3955.       if (this.fElementDepth >= 0) {
  3956.          int[] var2 = this.fElementChildren[this.fElementDepth];
  3957.          int var3 = this.fElementChildCount[this.fElementDepth];
  3958.          if (var2 == null) {
  3959.             var2 = this.fElementChildren[this.fElementDepth] = new int[8];
  3960.             var3 = 0;
  3961.          } else if (var3 == var2.length) {
  3962.             int[] var4 = new int[var3 * 2];
  3963.             System.arraycopy(var2, 0, var4, 0, var3);
  3964.             var2 = this.fElementChildren[this.fElementDepth] = var4;
  3965.          }
  3966.  
  3967.          var2[var3++] = var1;
  3968.          this.fElementChildCount[this.fElementDepth] = var3;
  3969.       }
  3970.  
  3971.       ++this.fElementDepth;
  3972.       if (this.fElementDepth == this.fElementNameStack.length) {
  3973.          int[] var5 = new int[this.fElementDepth * 2];
  3974.          System.arraycopy(this.fElementNameStack, 0, var5, 0, this.fElementDepth);
  3975.          this.fElementNameStack = var5;
  3976.          var5 = new int[this.fElementDepth * 2];
  3977.          System.arraycopy(this.fElementChildCount, 0, var5, 0, this.fElementDepth);
  3978.          this.fElementChildCount = var5;
  3979.          int[][] var8 = new int[this.fElementDepth * 2][];
  3980.          System.arraycopy(this.fElementChildren, 0, var8, 0, this.fElementDepth);
  3981.          this.fElementChildren = var8;
  3982.       }
  3983.  
  3984.       this.fElementNameStack[this.fElementDepth] = var1;
  3985.       this.fElementChildCount[this.fElementDepth] = 0;
  3986.    }
  3987.  
  3988.    private int elementStackDepth() {
  3989.       return this.fElementDepth;
  3990.    }
  3991.  
  3992.    private void charDataInContent() {
  3993.       int[] var1 = this.fElementChildren[this.fElementDepth];
  3994.       int var2 = this.fElementChildCount[this.fElementDepth];
  3995.       if (var1 == null) {
  3996.          var1 = this.fElementChildren[this.fElementDepth] = new int[8];
  3997.          var2 = 0;
  3998.       } else if (var2 == var1.length) {
  3999.          int[] var3 = new int[var2 * 2];
  4000.          System.arraycopy(var1, 0, var3, 0, var2);
  4001.          var1 = this.fElementChildren[this.fElementDepth] = var3;
  4002.       }
  4003.  
  4004.       var1[var2++] = -1;
  4005.       this.fElementChildCount[this.fElementDepth] = var2;
  4006.    }
  4007.  
  4008.    public int getCurrentContentSpecType() {
  4009.       return this.fElementDeclPool.getContentSpecType(this.fElementDeclPool.getElement(this.fElementNameStack[this.fElementDepth]));
  4010.    }
  4011.  
  4012.    private int peekElementName() {
  4013.       return this.fElementNameStack[this.fElementDepth];
  4014.    }
  4015.  
  4016.    private int peekChildCount() {
  4017.       return this.fElementChildCount[this.fElementDepth];
  4018.    }
  4019.  
  4020.    private int[] peekChildren() {
  4021.       return this.fElementChildren[this.fElementDepth];
  4022.    }
  4023.  
  4024.    private boolean popElementName() {
  4025.       if (this.fElementDepth < 0) {
  4026.          throw new RuntimeException("Element stack underflow");
  4027.       } else {
  4028.          return --this.fElementDepth >= 0;
  4029.       }
  4030.    }
  4031.  
  4032.    private boolean pushEntity(byte var1, int var2) throws Exception {
  4033.       for(int var3 = 0; var3 < this.fEntityStackDepth; ++var3) {
  4034.          if (this.fEntityNameStack[var3] == var2 && this.fEntityTypeStack[var3] == var1) {
  4035.             int var4 = var1 == 0 ? 139 : 97;
  4036.             int var5 = this.entityReferencePath(var1, var2);
  4037.             this.fErrorHandler.error2(var4, var2, var5);
  4038.             return false;
  4039.          }
  4040.       }
  4041.  
  4042.       if (this.fEntityTypeStack == null) {
  4043.          this.fEntityTypeStack = new byte[8];
  4044.          this.fEntityNameStack = new int[8];
  4045.       } else if (this.fEntityStackDepth == this.fEntityTypeStack.length) {
  4046.          byte[] var6 = new byte[this.fEntityStackDepth * 2];
  4047.          System.arraycopy(this.fEntityTypeStack, 0, var6, 0, this.fEntityStackDepth);
  4048.          this.fEntityTypeStack = var6;
  4049.          int[] var7 = new int[this.fEntityStackDepth * 2];
  4050.          System.arraycopy(this.fEntityNameStack, 0, var7, 0, this.fEntityStackDepth);
  4051.          this.fEntityNameStack = var7;
  4052.       }
  4053.  
  4054.       this.fEntityTypeStack[this.fEntityStackDepth] = var1;
  4055.       this.fEntityNameStack[this.fEntityStackDepth] = var2;
  4056.       ++this.fEntityStackDepth;
  4057.       return true;
  4058.    }
  4059.  
  4060.    private int peekEntity() {
  4061.       return this.fEntityStackDepth == 0 ? 0 : this.fEntityNameStack[this.fEntityStackDepth - 1];
  4062.    }
  4063.  
  4064.    private int peekEntityType() {
  4065.       return this.fEntityStackDepth == 0 ? 0 : this.fEntityTypeStack[this.fEntityStackDepth - 1];
  4066.    }
  4067.  
  4068.    private int entityReferencePath(byte var1, int var2) {
  4069.       StringBuffer var3 = new StringBuffer();
  4070.       var3.append("(top-level)");
  4071.  
  4072.       for(int var4 = 0; var4 < this.fEntityStackDepth; ++var4) {
  4073.          var3.append('-');
  4074.          var3.append((char)(this.fEntityTypeStack[var4] == 0 ? '&' : '%'));
  4075.          var3.append(this.fStringPool.toString(this.fEntityNameStack[var4]));
  4076.          var3.append(';');
  4077.       }
  4078.  
  4079.       var3.append('-');
  4080.       var3.append((char)(var1 == 0 ? '&' : '%'));
  4081.       var3.append(this.fStringPool.toString(var2));
  4082.       var3.append(';');
  4083.       return this.fStringPool.addString(var3.toString());
  4084.    }
  4085.  
  4086.    private void popEntity() {
  4087.       --this.fEntityStackDepth;
  4088.    }
  4089.  
  4090.    private void initializeContentModelStack(int var1) {
  4091.       if (this.opStack == null) {
  4092.          this.opStack = new byte[8];
  4093.          this.nodeIndexStack = new int[8];
  4094.          this.prevNodeIndexStack = new int[8];
  4095.       } else if (var1 == this.opStack.length) {
  4096.          byte[] var2 = new byte[var1 * 2];
  4097.          System.arraycopy(this.opStack, 0, var2, 0, var1);
  4098.          this.opStack = var2;
  4099.          int[] var3 = new int[var1 * 2];
  4100.          System.arraycopy(this.nodeIndexStack, 0, var3, 0, var1);
  4101.          this.nodeIndexStack = var3;
  4102.          var3 = new int[var1 * 2];
  4103.          System.arraycopy(this.prevNodeIndexStack, 0, var3, 0, var1);
  4104.          this.prevNodeIndexStack = var3;
  4105.       }
  4106.  
  4107.       this.opStack[var1] = 0;
  4108.       this.nodeIndexStack[var1] = -1;
  4109.       this.prevNodeIndexStack[var1] = -1;
  4110.    }
  4111. }
  4112.